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

[Fix] Add load_url to handle incompatibility of PyTorch versions #1377

Merged
merged 8 commits into from
Nov 19, 2021

Conversation

zhouzaida
Copy link
Collaborator

@zhouzaida zhouzaida commented Sep 26, 2021

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Add load_url to handle incompatibility of PyTorch versions.

The 1.6 release of PyTorch switched torch.save to use a new zipfile-based file format. It will cause RuntimeError when a
checkpoint was saved in torch >= 1.6.0 but loaded in torch < 1.7.0. More
details at open-mmlab/mmpose#904

Modification

Add load_url function.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Checklist

Before PR:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects, like MMDet or MMCls.
  • CLA has been signed and all committers have signed the CLA in this PR.

@zhouzaida zhouzaida mentioned this pull request Sep 26, 2021
29 tasks
@codecov
Copy link

codecov bot commented Sep 26, 2021

Codecov Report

Merging #1377 (0aad9c5) into master (8cac7c2) will decrease coverage by 0.00%.
The diff coverage is 57.14%.

❗ Current head 0aad9c5 differs from pull request most recent head 3167705. Consider uploading reports for the commit 3167705 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1377      +/-   ##
==========================================
- Coverage   68.59%   68.59%   -0.01%     
==========================================
  Files         164      164              
  Lines       10891    10896       +5     
  Branches     1991     1992       +1     
==========================================
+ Hits         7471     7474       +3     
- Misses       3030     3031       +1     
- Partials      390      391       +1     
Flag Coverage Δ
unittests 68.59% <57.14%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmcv/runner/checkpoint.py 74.17% <57.14%> (-0.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd6eab6...3167705. Read the comment docs.

@zhouzaida zhouzaida added the WIP label Sep 30, 2021
@zhouzaida zhouzaida changed the title [Fix] Fix the default value of _use_new_zipfile_serialization in torch.save [Fix] Add load_url to handle incompatibility of PyTorch versions Oct 10, 2021
@zhouzaida zhouzaida removed the WIP label Oct 11, 2021
@zhouzaida
Copy link
Collaborator Author

please @innerlee have a look

@zhouzaida zhouzaida mentioned this pull request Oct 16, 2021
11 tasks
@ZwwWayne
Copy link
Collaborator

ZwwWayne commented Nov 2, 2021

Can be merged after resolving conflicts

@ZwwWayne ZwwWayne merged commit 990d8b6 into open-mmlab:master Nov 19, 2021
@zhouzaida zhouzaida deleted the fix-torch-load-error branch November 19, 2021 09:45
zhouzaida added a commit that referenced this pull request Nov 27, 2021
* [Fix] Fix torch.load error

* [Fix] Fix torch.load error

* rename _save to _save_ckpt

* add load_url to handle imcompatibility of PyTorch versions

* add unittest for load_url

* fix typo

* print a friendly information when error occurred
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

Successfully merging this pull request may close these issues.

4 participants