Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Auto Scheduler] Upgrade autoscheduler xgboost callback #12144

Conversation

Sunny-Island
Copy link
Contributor

@Sunny-Island Sunny-Island commented Jul 20, 2022

Fixes #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 Sunny-Island changed the title Sunny island/upgrade autoscheduler xgboost callback Upgrade autoscheduler xgboost callback Jul 20, 2022
@Sunny-Island Sunny-Island changed the title Upgrade autoscheduler xgboost callback [Auto Scheduler] Upgrade autoscheduler xgboost callback Jul 20, 2022
@Sunny-Island
Copy link
Contributor Author

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?

Copy link
Contributor

@shingjan shingjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sending this PR! Would that be possible that we can add some specific tests? Also it would be great if this change can be compatible with older versions of xgboost just in case.

python/tvm/auto_scheduler/cost_model/xgb_model.py Outdated Show resolved Hide resolved
python/tvm/auto_scheduler/cost_model/xgb_model.py Outdated Show resolved Hide resolved
@Sunny-Island Sunny-Island force-pushed the Sunny-Island/upgrade_autoscheduler_xgboost_callback branch from 88ce5be to 8edc397 Compare July 22, 2022 09:24
@Sunny-Island
Copy link
Contributor Author

Please review this PR again @shingjan

@junrushao
Copy link
Member

junrushao commented Jul 30, 2022

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

@Sunny-Island
Copy link
Contributor Author

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 #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.

@junrushao
Copy link
Member

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...

@Sunny-Island
Copy link
Contributor Author

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

@junrushao
Copy link
Member

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

@areusch areusch added needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it and removed needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it labels Oct 19, 2022
@shingjan
Copy link
Contributor

shingjan commented Dec 5, 2022

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!

Copy link
Contributor

@cbalint13 cbalint13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sunny-Island

  • This works fine with latest xgboost 1.7.2 @ 2022-12-09
  • Tested on tune_network_x86 demonstrator using autoscheduler
$ rpm -q xgboost-python3
xgboost-python3-1.7.2-20221209.0.git42e6fbb0.cu11_8.fc38.x86_64

$ rpm -q tvm tvm-python3
tvm-0.11-20221209.0.git0dc26dd8.cu11_8.fc38.x86_64
tvm-python3-0.11-20221209.0.git0dc26dd8.cu11_8.fc38.x86_64

Cc @driazati for help to see if this PR pass builders having a bumped xgboost >= 1.7.2

@masahi
Copy link
Member

masahi commented Feb 21, 2023

I'm assuming this has been superceded by #14036

@masahi masahi closed this Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] xgboost version conflict
6 participants