xgboost: Model produced in 1.0.0 cannot be loaded into 0.90

Following the instructions here: https://xgboost.readthedocs.io/en/latest/R-package/xgboostPresentation.html

> install.packages("drat", repos="https://cran.rstudio.com")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/drat_0.1.5.zip'
Content type 'application/zip' length 87572 bytes (85 KB)
downloaded 85 KB

package ‘drat’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\lee\AppData\Local\Temp\RtmpiE0N3D\downloaded_packages
> drat:::addRepo("dmlc")
> install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source")
Warning: unable to access index for repository http://dmlc.ml/drat/src/contrib:
  Line starting '<!DOCTYPE html> ...' is malformed!
Warning message:
package ‘xgboost’ is not available (for R version 3.6.0) 

It also fails on R 3.6.2 with the same error.

Note: I would much prefer to use the CRAN version. But models I train on linux and Mac and save using the saveRDS function don’t predict on another system (windows), they just produce numeric(0). If anyone has any guidelines on how to save an XGBoost model for use on other computers, please let me know. I’ve tried xgb.save.raw and xgb.load - both produce numeric(0) as well. But on the computer I trained the model on (a month ago), readRDS in R works just fine. Absolutely baffling to me.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 74 (22 by maintainers)

Most upvoted comments

I’ve successfully reproduced the issue on linux - see attached screenshot.

I am uploading the virtual box to dropbox. But in case you’d prefer to install from scratch, instructions to replicate are as follows:

  1. Download and install virtualbox
  2. Download a build of ubuntu bionic beaver (I used ubuntu-18.04.3-desktop-amd64).
  3. Follow instructions here: https://medium.com/@mannycodes/installing-ubuntu-18-04-on-mac-os-with-virtualbox-ac3b39678602. I used a fixed 15 gigabyte virtual drive
  4. Configure for R 3.6.2 by the following:
sudo apt-get update
sudo apt-get install vim
sudo vim /etc/apt/sources.list
i
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
<esc> :wq
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg -a --export E298A3A825C0D65DFD57CBB651716619E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get install r-base-dev
  1. install packages in R

install.packages(c("caret", "xgboost")) 6. load packages in R

library(caret)
library(xgboost)
  1. Load the data
modelList <- readRDS("~/Desktop/modelList.rdata")
attach(modelList)
  1. Attempt to predict
predict(object=xgbModel, newdata=as.matrix(caretModel$trainingData[,!colnames(caretModel$trainingData) %in% ".outcome"]))

And this returned the now familiar:

[13:00:55] WARNING: amalgamation/…/src/objective/regression_obj.cu:152: reg:linear is now deprecated in favor of reg:squarederror. numeric(0)

Screen Shot 2020-02-23 at 12 33 13 PM

note: I tried explicit calling libraries, and just trying the prediction. Both resulted in the same numeric(0) response.

Hi, I’m faced with similar issues with Python. I saved the model via xgboost 1.0.1, and loaded it via xgboost 0.9, and the predictions are empty lists. Since our production environment is using xgboost 0.9, I’m wondering if there’s any way I can load a saved-via-xgboost-1.0 model into xgboost 0.9?

@hetong007 Nice. Please tell Prof. Ripley thanks for taking time to debug the problem. I will go ahead and guard that line to only run in proper Linux environment only, since we only have proper testing facility to test XGBoost with Windows and Linux. Ideally, any non-standard C++ facilities should not be used unless they are first tested as part of CI. I will also have to scan the codebase for other non-standard C++ features and try to remove them as well. cc @trivialfis

@hcho3 Could you please try using std::fill first? Even the compiler may not be able to optimize it into memset, I don’t think it’s critical enough to have any visible performance impact.

@hetong007 I just downloaded Solaris VM image from Oracle that can run with VirtualBox. Let me try to reproduce the issue.

@hcho3 Sounds good, given that we have a valid endian detection. I’ll make a submission in a week.