Skip to content
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

Issue with saving the best model state #667

Closed
yuanx749 opened this issue Mar 21, 2025 · 4 comments
Closed

Issue with saving the best model state #667

yuanx749 opened this issue Mar 21, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@yuanx749
Copy link

Issue description

Hi, thanks for this great tool!

I believe the line below should be self.best_model_dict = deepcopy(self.model.state_dict()). Otherwise the best model keeps getting updated, because model.state_dict() returns a reference to the dict.

self.best_model_dict = self.model.state_dict()

I encountered this issue when training a model with more epochs, I got different results even though the best model is at the same epoch.

Your contribution

As suggested in the description.

@yuanx749 yuanx749 added the question Further information is requested label Mar 21, 2025
Copy link

Hi there 👋,

Thank you so much for your attention to PyPOTS! You can follow me on GitHub to receive the latest news of PyPOTS.
If you find PyPOTS helpful to your work, please star⭐️ this repository to get this issue prioritized.
Your star is your recognition, which can help more people notice PyPOTS and grow PyPOTS community.
It matters and is definitely a kind of contribution to the community.

Best,
Wenjie

@WenjieDu
Copy link
Owner

Hi @yuanx749, thanks for raising this issue. I agree with you. I'm going to label this issue as bug. Would you like to make a PR to fix this? This could be your first contribution to PyPOTS ;-)

@WenjieDu WenjieDu added bug Something isn't working and removed question Further information is requested labels Mar 21, 2025
@yuanx749
Copy link
Author

Hi @WenjieDu , thanks for your quick response. I'll look into this next week, but since it's a small change, you can go ahead and make the fix if you'd like. :)

@WenjieDu
Copy link
Owner

No problem, Xiao. I've created PR #668 to fix it. Please have a review ;~)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants