-
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
[python] Neptune LightGBM callback yields an error with the new logic introduced in v3.3.0 #4719
Comments
Thanks for the report! Just a small note, I've modified your initial description to include a link that is anchored to a specific commit. That way, that link will continue to point to the code you're talking about, even if the file is changed. In case you're not familiar with this feature of GitHub, you can see https://docs.github.com/en/repositories/working-with-files/using-files/getting-permanent-links-to-files#press-y-to-permalink-to-a-file-in-a-specific-commit. |
Thanks! It was pinned to the v3.3.0 tag, so that should have been fine |
Ah, sorry! I probably just misread that. 😂
Looking at the blame, I can see the change you're talking about came from #4574, specifically. I'm not sure if we've ever discussed this question: do all callbacks need to be serializable? Based on the usage I see in LightGBM/python-package/lightgbm/engine.py Line 229 in 717f037
That Can you think of a way to achieve both the behavior " If not, maybe the solution here is a change in neptune instead of |
Sounds strange why we should limit the callbacks to be serializable objects. What's the reasoning for that other than avoiding side effects (which are desirable given the Neptune integration, since we want to send metrics during the training process)? |
Tagging neptune integration contributors who might be interested in this issue. |
Actually, we LightGBM/python-package/lightgbm/sklearn.py Lines 745 to 746 in fa4ecf4
Given the list mutability it is unacceptable to append to the originally provided callback argument. Also, there can be some critical crashes in the sklearn-wrapper specifically due to this reason. For example, refer toLightGBM/python-package/lightgbm/sklearn.py Lines 628 to 630 in fa4ecf4
#2610. But I guess (requires more investigation) that for this particular case with |
Yes, thanks! The only critical thing was just passing the neptune integration as one of the callbacks.
|
@jameslamb Don't you mind including this into the upcoming |
@StrikerRUS sure, seems ok to me, as long as it can be done quickly. I don't want to delay too long, since I think getting the R package back up on CRAN should be treated as a fairly urgent concern.
To be clear, this is what I meant by "wanted to avoid having side-effects on the user-provided list". Thanks for adding a bit more detail there in case my language wasn't clear! |
Right, so I think all it would take is just replacing deepcopy with copy here LightGBM/python-package/lightgbm/sklearn.py Line 733 in fa4ecf4
@StrikerRUS will you create a PR please? |
Yeah, I can do this today. |
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
Neptune-LightGBM integration is broken due to changes in handling the callbacks in v3.3.0.
Reproducible example
This fails with
Environment info
LightGBM version: 3.3.0
Additional Comments
neptune-lightgbm version: 0.9.13
neptune-client version: 0.10.10
The reason why this happens is because of using a deepcopy for callbacks:
LightGBM/python-package/lightgbm/sklearn.py
Line 733 in fa4ecf4
Indeed, the error is the same for the code below:
The text was updated successfully, but these errors were encountered: