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

Save the model - TypeError: can't pickle Rfft objects #7

Closed
idansc opened this issue Apr 14, 2018 · 3 comments
Closed

Save the model - TypeError: can't pickle Rfft objects #7

idansc opened this issue Apr 14, 2018 · 3 comments

Comments

@idansc
Copy link

idansc commented Apr 14, 2018

How do you save and load the model, I'm using torch.save, which cause the following error:

File "x/anaconda3/lib/python3.6/site-packages/tor                                                                                                                               ch/serialization.py", line 135, in save
   return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickl                                                                                                                               e_protocol))
 File "x/anaconda3/lib/python3.6/site-packages/tor                                                                                                                               ch/serialization.py", line 117, in _with_file_like
   return body(f)
 File "xanaconda3/lib/python3.6/site-packages/tor                                                                                                                               ch/serialization.py", line 135, in <lambda>
   return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickl                                                                                                                               e_protocol))
 File "x/anaconda3/lib/python3.6/site-packages/tor                                                                                                                               ch/serialization.py", line 198, in _save
   pickler.dump(obj)
TypeError: can't pickle Rfft objects

@gdlg
Copy link
Owner

gdlg commented Apr 14, 2018

Could you post a small example illustrating the problem?
I think that you are trying to save the model itself rather than model.state_dict().

@idansc
Copy link
Author

idansc commented Apr 14, 2018

You are right, I do save the model and not the parameters. Is it a wrong usage? I think both methods should work. I feel a little safer saving the actual model. It can be used to reconstruct the original model files in case of refactoring.

@gdlg
Copy link
Owner

gdlg commented Apr 14, 2018

I am not sure whether it is right or not; I have always only saved the parameters. However the problem here lies with the Rfft class in pytorch_fft (and I suspect that all the other FFT variants in pytorch_fft have the same problem); perhaps you should open an issue with pytorch_fft. If the issue is fixed in pytorch_fft, it should work without any change to this repo.

@idansc idansc closed this as completed Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants