xgboost/removed-gpu-hist
| Rule | removed-gpu-hist |
|---|---|
| Pack | XGBoost |
| Severity | error |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | XGBoost 3.1 and later |
XGBoost 3.1 removed the gpu_hist tree method. Training a tree booster with
that value raises an error.
model = xgb.XGBClassifier(tree_method="gpu_hist")model = xgb.XGBClassifier(tree_method="hist", device="cuda")What the rule reports
Section titled “What the rule reports”The rule checks literal gpu_hist values on XGBoost estimator constructors
and in dictionaries passed directly as params to train or cv. It
recognizes adjacent string literals such as "tree_" "method" and
"gpu_" "hist", including raw and Unicode prefixes. A later literal
tree_method key overrides the earlier value. A later unrelated plain
string key leaves it in effect.
The matcher reads source text. It cannot decode Python escapes such as
\x5f into underscores. An escaped key, a computed key, or a dictionary
unpack after tree_method can make the effective value uncertain.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to migrate an estimator constructor
whose only argument is tree_method="gpu_hist". For other cases, edit the
configuration by hand. Use tree_method="hist" with device="cuda" for GPU training. If the old
configuration selected a specific GPU with gpu_id, use the corresponding
device string, such as device="cuda:1", in single-node training.
3.1 release notes · Device and tree method parameters
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
XGBoost 3.1 removed tree_method="gpu_hist". Use tree_method="hist" and set device to "cuda" or the intended CUDA device ordinal.Browse the other rules of the XGBoost pack.