tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Auto Scheduler] Upgrade autoscheduler xgboost callback

Open Sunny-Island opened this issue 2 years ago • 5 comments

  • What this PR do: This pull request is related to issue #12009 .
  1. I upgrade custom callback function type to xgboost latest version callback.TrainingCallBack function.
  2. Because xgboost.cv() will never be called in previous code, I remove all code related to xgboost crossfold.
  • Test I test the new code in CentOS system and xgboost==1.6.0 with a llvm-based auto_schedule task. The task works without any regression problem.

I will work on meta_schedule later, and pay attention to any reviews in this PR.

Sunny-Island avatar Jul 20 '22 07:07 Sunny-Island

In pr-head CI check, an error happens:

[2022-07-20T07:57:45.501Z] python3 build_model.py -o build --test
[2022-07-20T07:57:46.065Z] Traceback (most recent call last):
[2022-07-20T07:57:46.065Z]   File "build_model.py", line 21, in <module>
[2022-07-20T07:57:46.065Z]     from tvm import relay
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/__init__.py", line 79, in <module>
[2022-07-20T07:57:46.065Z]     from . import micro
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/micro/__init__.py", line 23, in <module>
[2022-07-20T07:57:46.065Z]     from .model_library_format import (
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/micro/model_library_format.py", line 34, in <module>
[2022-07-20T07:57:46.065Z]     from ..relay.backend import executor_factory
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/relay/__init__.py", line 29, in <module>
[2022-07-20T07:57:46.065Z]     from . import prelude
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/relay/prelude.py", line 21, in <module>
[2022-07-20T07:57:46.065Z]     from tvm.relay.transform import ToANormalFormExpr
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/relay/transform/__init__.py", line 20, in <module>
[2022-07-20T07:57:46.065Z]     from .transform import *
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/relay/transform/transform.py", line 31, in <module>
[2022-07-20T07:57:46.065Z]     from ..backend.utils import mangle_module_name
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/relay/backend/__init__.py", line 18, in <module>
[2022-07-20T07:57:46.065Z]     from . import te_compiler
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/relay/backend/te_compiler.py", line 26, in <module>
[2022-07-20T07:57:46.065Z]     from tvm.auto_scheduler import is_auto_scheduler_enabled
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/auto_scheduler/__init__.py", line 20, in <module>
[2022-07-20T07:57:46.065Z]     from . import (
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/auto_scheduler/dispatcher.py", line 34, in <module>
[2022-07-20T07:57:46.065Z]     from .cost_model import RandomModel, XGBModel
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/auto_scheduler/cost_model/__init__.py", line 21, in <module>
[2022-07-20T07:57:46.065Z]     from .xgb_model import XGBModel
[2022-07-20T07:57:46.065Z]   File "/workspace/python/tvm/auto_scheduler/cost_model/xgb_model.py", line 25, in <module>
[2022-07-20T07:57:46.065Z]     from xgboost import callback

I notice xgboost is not imported at beginning of this file. How could I use xgboost.callback.TrainingCallBack to define callback function? Any advices here?

Sunny-Island avatar Jul 20 '22 08:07 Sunny-Island

Please review this PR again @shingjan

Sunny-Island avatar Jul 25 '22 04:07 Sunny-Island

The review has been stale for 4 days without any update. To unblock the progress, I would suggest that someone (maybe @Hzfengsy) to validate it locally and then get it merged at our earliest convenience

junrushao avatar Jul 30 '22 08:07 junrushao

The review has been stale for 4 days without any update. To unblock the progress, I would suggest that someone (maybe @Hzfengsy) to validate it locally and then get it merged at our earliest convenience

I am still wait for https://github.com/apache/tvm/pull/12141 to be reviewed so that I can follow its design(It seems that that pr have been done, I will finish unit test soon). But It's fine this pr can be merged now.

Sunny-Island avatar Jul 30 '22 08:07 Sunny-Island

I don't think a unit test is viable specifically for xgboost version compatibility because (IIUC) our CI instance could only install one version of xgboost...

junrushao avatar Jul 30 '22 09:07 junrushao

I don't think a unit test is viable specifically for xgboost version compatibility because (IIUC) our CI instance could only install one version of xgboost...

Hi, sorry I am quarantined because COVID-19 and this work was put on hold. Can we merge this PR now? Or unit test is necessary? @junrushao

Sunny-Island avatar Aug 23 '22 02:08 Sunny-Island

CC @zxybazh would you like to review this PR? Thanks a lot!

junrushao avatar Sep 24 '22 01:09 junrushao

Hi @Sunny-Island, I wonder if you are still on this PR? There are quite some changes introduced to the use of xgboost in meta schedule after your PR. I wonder if you are willing to incorporate those into your PR and I can take another look after that. Otherwise I can take this over and make the necessary change to upgrade xgboost. Let me know if that works. Thanks!

shingjan avatar Dec 05 '22 20:12 shingjan

I'm assuming this has been superceded by https://github.com/apache/tvm/pull/14036

masahi avatar Feb 21 '23 10:02 masahi