-
Notifications
You must be signed in to change notification settings - Fork 76
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
TypeError: can't pickle weakref objects #13
Comments
ME TOO! This problem still exists though changed to DP from the original DDP! -> torch.save(ema, os.path.join(opt.output_dir, now + 'ema.pth'))
(Pdb) n
TypeError: cannot pickle 'weakref' object |
change that line adding .state_dict(), same w all other lines where modules are saved |
This may be related to different library versions since it works on our machines. Thanks for posting a solution for others who run into this issue. |
This saved me. Thanks! |
Thanks! And in case someone else meets error while updating ema parameters at
don't forget to change the ema loading method to:
|
Error is showing : cannot pickle 'weakref' object |
I fixed it by adding .state_dict():
torch.save(ema.state_dict(), os.path.join(opt.output_dir, now + 'ema.pth'))
torch.save(ema2.state_dict(), os.path.join(opt.output_dir, now + 'ema2.pth'))
The text was updated successfully, but these errors were encountered: