-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Deepcopy lightgbm model causing missing parameters? #4085
Comments
After digging into the source code, this seems to be the root cause, the LightGBM/python-package/lightgbm/basic.py Lines 2279 to 2282 in d6ebd06
Those commit are quite old already (2+years), I wonder why a custom implementation of |
Hi @noklam !
Custom |
If I understand correctly, the fix should be release in the next version and parameters could be saved with mode? May I ask what's making it not picklable? Just trying to learn more about the issue |
Unfortunately, there is no fix for that yet. |
It seems picklable even without the deepcopy method? I try removed the import lightgbm
from lightgbm import Booster
del Booster.__deepcopy__
params = {
'objective': 'regression',
'verbose': -1,
'num_leaves': 3
}
X = np.random.rand(100,2)
Y = np.ravel(np.random.rand(100,1))
lgbm = lgb.train(params, lgb.Dataset(X,label=Y),num_boost_round=1)
deepcopy_lgbm = deepcopy(lgbm)
lgbm.params, deepcopy_lgbm.params |
Please refer to the following PR where custom |
But I think that without custom |
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Description
Deepcopy lightgbm model causing model lost parameters
Reproducible example
Output:
Environment info
Windows 10, Python 3.7.5
LightGBM version or commit hash:
Tested with both lightgbm==2.3.1 and lightgbm==3.1.1 (latest pip version)
Command(s) you used to install LightGBM
Additional Comments
The text was updated successfully, but these errors were encountered: