xgboost icon indicating copy to clipboard operation
xgboost copied to clipboard

Problem predicting in CPU using a model trained in GPU

Open phisanti opened this issue 3 years ago • 1 comments

I am having some problems using the predict function of the xgboost package. It seems to originate from the fact that the machine was trained in a GPU but the prediction take place in a CPU only machine. I have also posted the issue here because I am not sure this issue arises from xgboost or mlr3. I have also seen that the issue has appeared in the python version here.

Here is my code:

library(mlr3)

d <- fread('path/to/data')

modelup$predict_newdata(d)

error print:

[20:44:33] WARNING: amalgamation/../src/gbm/gbtree.cc:386: Loading from a raw memory buffer on CPU only machine.  Changing tree_method to hist.
Error in doTryCatch(return(expr), name, parentenv, handler) : 
  [20:44:33] amalgamation/../src/tree/tree_updater.cc:20: Unknown tree updater grow_gpu_hist

I am currently using the version 1.5.1 of xgboost.

phisanti avatar Apr 02 '22 20:04 phisanti

Hi, here's my guess on what happened:

  • The training parameter updater is used instead of tree_method. Please choose the latter instead.
  • The model is not persisted using xgb.save, please consider using this function for model serialization.

trivialfis avatar Apr 02 '22 20:04 trivialfis

Closing as stalled. Feel free to reopen if there's any new info.

trivialfis avatar Oct 10 '22 05:10 trivialfis