-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Can't read old models saved with saveRDS.lgb.Booster on version 4.3.0 of lightgbm #6560
Comments
Thanks for using LightGBM.
The answer to this question will depend on your answers to those questions. And can you please edit the description as follows?
|
Thanks for your response.
Both those questions are hard to answer as I don't keep track of the version of neither R or my packages when I run a code. The objects date from before 2023, therefore I can expect R to have been around version 4.2.* and lightgbm at version 3.3.*. It's the best I can do, sorry. About the formatting, sorry about the doubling of the first sentence, it's a copy-paste error that happened after I reread my post. As for the screenshots, I don't want to get into an argument here. I know my question wasn't up to standard. Print screens are to avoid and reproducible example that are easily copy-pasted and machine readable is what to aim for. However, I work in a corporate environment that as no other way out but screenshots. It was pretty much that or nothing. Making a reproducible example would imply building two different environments, one old to save a model and one new to read it, which is time consuming. I (wrongly?) expected my question to be relatively strait forward and simple and a direct consequence of deprecating |
Ok thanks. When I have time to look at this again, I'll try to create a reproducible example for you using R 4.2.0 and If you plan on using See:
It's fine. I manually retyped the code from your screenshots. It took me just 30 seconds, and now this issue will be discoverable by others facing the same problem and searching for those error messages. |
Description
I have a long term project that uses
lightgbm
for the modeling. I made a bunch of models throughout the years which I access again from time to time to predict on new data. I used to save my models withlightgbm::saveRDS.lgb.Booster()
and read them withlightgbm::readRDS.lgb.Booster()
. I’m trying to run the code withlightgbm
version 4.3.0, and now my code fails telling me thelightgbm::readRDS.lgb.Booster()
doesn’t exist anymore:I’ve found in this issue (rstudio/bundle#55) that the function was remove and that we should use
readRDS
instead. When I do so, the model is loaded with no error:However, the object created is unusable:
Is there a way to load old model created with
lightgbm::saveRDS.lgb.Booster()
back into the new version of lightgbm? I guess either by makingreadRDS
works with files created withsaveRDS.lgb.Booster()
or add back thelightgbm::readRDS.lgb.Booster()
into the package for this kind of use cases?Rerunning all my old models would be difficult and downgrading my version of lightgbm do not sound ideal either.
Reproducible example
See print screen above. Sorry I work in a close environment and can't export objects or code.
Environment info
LightGBM version 4.3.0 install from CRAN,
working in R 4.4.0 on a windows machine
The text was updated successfully, but these errors were encountered: