salesforce / awd-lstm-lm

LSTM and QRNN Language Model Toolkit for PyTorch
BSD 3-Clause "New" or "Revised" License
1.96k stars 488 forks source link

cPickle.PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup __builtin__.instancemethod failed #92

Open ghost opened 5 years ago

ghost commented 5 years ago

Traceback (most recent call last): File "main.py", line 271, in model_save(args.save) File "main.py", line 85, in model_save torch.save([model,criterion,optimizer], f) File "/nfs/project/tools/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 209, in save return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol)) File "/nfs/project/tools/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 134, in _with_file_like return body(f) File "/nfs/project/tools/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 209, in return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol)) File "/nfs/project/tools/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 282, in _save pickler.dump(obj)

when I run this code, and cause this problem. How should I solve it?

DavidNemeskey commented 5 years ago

From README.md: "Python 3 and PyTorch 0.4 are required for the current codebase."

Try running it under Python 3.