[train] Fold v2.XGBoostTrainer API into the public trainer class as an alternate constructor#50045
Merged
justinvyu merged 17 commits intoray-project:masterfrom Mar 11, 2025
Merged
Conversation
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
matthewdeng
reviewed
Jan 31, 2025
Contributor
matthewdeng
left a comment
There was a problem hiding this comment.
This is very elegant!
Comment on lines
+130
to
+133
| # TODO(justinvyu): [Deprecated] Legacy XGBoostTrainer API | ||
| label_column: Optional[str] = None, | ||
| params: Optional[Dict[str, Any]] = None, | ||
| num_boost_round: Optional[int] = None, |
Contributor
There was a problem hiding this comment.
Are these needed for the V2 API? These are not passed in from the V1 API.
Contributor
Author
There was a problem hiding this comment.
This is train/v2/xgboost, not train/xgboost/v2, so people who use RAY_TRAIN_V2_ENABLED would possibly be passing in the xgboost V1 API. 😂 😭 💀 🪦
justinvyu
commented
Feb 7, 2025
Comment on lines
+130
to
+133
| # TODO(justinvyu): [Deprecated] Legacy XGBoostTrainer API | ||
| label_column: Optional[str] = None, | ||
| params: Optional[Dict[str, Any]] = None, | ||
| num_boost_round: Optional[int] = None, |
Contributor
Author
There was a problem hiding this comment.
This is train/v2/xgboost, not train/xgboost/v2, so people who use RAY_TRAIN_V2_ENABLED would possibly be passing in the xgboost V1 API. 😂 😭 💀 🪦
Comment on lines
+191
to
+205
| train_loop_per_worker: Optional[ | ||
| Union[Callable[[], None], Callable[[Dict], None]] | ||
| ] = None, | ||
| train_loop_config: Optional[Dict] = None, | ||
| xgboost_config: Optional[XGBoostConfig] = None, | ||
| scaling_config: Optional[ray.train.ScalingConfig] = None, | ||
| run_config: Optional[ray.train.RunConfig] = None, | ||
| datasets: Optional[Dict[str, GenDataset]] = None, | ||
| dataset_config: Optional[ray.train.DataConfig] = None, | ||
| resume_from_checkpoint: Optional[Checkpoint] = None, | ||
| metadata: Optional[Dict[str, Any]] = None, | ||
| # TODO(justinvyu): [Deprecated] Legacy XGBoostTrainer API | ||
| label_column: Optional[str] = None, | ||
| params: Optional[Dict[str, Any]] = None, | ||
| num_boost_round: Optional[int] = None, |
Contributor
Author
There was a problem hiding this comment.
Note: it's fine to change the ordering of these params because they were already forced to be kwargs.
…ost/merge_v2 Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Justin Yu <justinvyu@anyscale.com>
qinyiyan
pushed a commit
to qinyiyan/ray
that referenced
this pull request
Mar 13, 2025
… an alternate constructor (ray-project#50045) Currently, the new `XGBoostTrainer` API is only accessible with a separate import `ray.train.xgboost.v2.XGBoostTrainer`. To avoid unnecessary import changes, this PR folds the new API, which accepts new arguments `(train_loop_per_worker, train_loop_config, xgboost_config)`, into the public `ray.train.xgboost.XGBoostTrainer` class. This also makes some changes in the Ray Train v2 `XGBoostTrainer` class to improve the migration UX, since it does not support the legacy `XGBoostTrainer` API at all. --------- Signed-off-by: Justin Yu <justinvyu@anyscale.com>
park12sj
pushed a commit
to park12sj/ray
that referenced
this pull request
Mar 18, 2025
… an alternate constructor (ray-project#50045) Currently, the new `XGBoostTrainer` API is only accessible with a separate import `ray.train.xgboost.v2.XGBoostTrainer`. To avoid unnecessary import changes, this PR folds the new API, which accepts new arguments `(train_loop_per_worker, train_loop_config, xgboost_config)`, into the public `ray.train.xgboost.XGBoostTrainer` class. This also makes some changes in the Ray Train v2 `XGBoostTrainer` class to improve the migration UX, since it does not support the legacy `XGBoostTrainer` API at all. --------- Signed-off-by: Justin Yu <justinvyu@anyscale.com>
dhakshin32
pushed a commit
to dhakshin32/ray
that referenced
this pull request
Mar 27, 2025
… an alternate constructor (ray-project#50045) Currently, the new `XGBoostTrainer` API is only accessible with a separate import `ray.train.xgboost.v2.XGBoostTrainer`. To avoid unnecessary import changes, this PR folds the new API, which accepts new arguments `(train_loop_per_worker, train_loop_config, xgboost_config)`, into the public `ray.train.xgboost.XGBoostTrainer` class. This also makes some changes in the Ray Train v2 `XGBoostTrainer` class to improve the migration UX, since it does not support the legacy `XGBoostTrainer` API at all. --------- Signed-off-by: Justin Yu <justinvyu@anyscale.com> Signed-off-by: Dhakshin Suriakannu <d_suriakannu@apple.com>
justinvyu
added a commit
that referenced
this pull request
Apr 9, 2025
…s as an alternate constructor (#51265) This PR is a follow-up of #50045, which folds the new LightGBM API into `ray.train.lightgbm.LightGBMTrainer` so that users don't need to change their imports to use the new custom train function API. --------- Signed-off-by: Hongpeng Guo <hpguo@anyscale.com> Signed-off-by: Justin Yu <justinvyu@anyscale.com> Co-authored-by: Justin Yu <justinvyu@anyscale.com>
han-steve
pushed a commit
to han-steve/ray
that referenced
this pull request
Apr 11, 2025
…s as an alternate constructor (ray-project#51265) This PR is a follow-up of ray-project#50045, which folds the new LightGBM API into `ray.train.lightgbm.LightGBMTrainer` so that users don't need to change their imports to use the new custom train function API. --------- Signed-off-by: Hongpeng Guo <hpguo@anyscale.com> Signed-off-by: Justin Yu <justinvyu@anyscale.com> Co-authored-by: Justin Yu <justinvyu@anyscale.com> Signed-off-by: Steve Han <stevehan2001@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently, the new
XGBoostTrainerAPI is only accessible with a separate importray.train.xgboost.v2.XGBoostTrainer.To avoid unnecessary import changes, this PR folds the new API, which accepts new arguments
(train_loop_per_worker, train_loop_config, xgboost_config), into the publicray.train.xgboost.XGBoostTrainerclass.This also makes some changes in the Ray Train v2
XGBoostTrainerclass to improve the migration UX, since it does not support the legacyXGBoostTrainerAPI at all.TODO
XGBoostTrainerandLightGBMTrainerAPI revamps #50042