NVIDIA / NVIDIA/apex

torch.save(model, 'best_model.pth') error with opt_level="O1"

Open
#415 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

Traceback (most recent call last):
File "/home/song/PycharmProjects/RSCDNet/train_amp.py", line 482, in
torch.save(model, '{}/best_model.pth'.format(model_save_dir))
File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 224, in save
return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 149, in _with_file_like
return body(f)
File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 224, in
return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 297, in _save
pickler.dump(obj)
_pickle.PicklingError: Can't pickle <function interpolate at 0x7fcb09251f28>: it's not the same object as torch.nn.functional.interpolate

Process finished with exit code 1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the reported torch.save call in train_amp.py and the traceback from torch.serialization.py, then reproduce the failure with opt_level="O1". Confirm whether model saving succeeds without the reported PicklingError; the issue does not identify a repository test or a proposed change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.