-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Allow torch.hub.load() to load models from any local directory with a hubconf.py #44204
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
Conversation
💊 CI failures summary and remediationsAs of commit 19d603d (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 26 times. |
44cffd0 to
ddc17e4
Compare
|
@ailzhang, here's the PR. I don't believe the CI errors are related. |
ailzhang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Overall looks good!
Btw I feel having something like torch.load(<path_to_local_dir>|<github_repo>, source='github'|'local') could be a better unified user facing API? I'm definitely open to suggestions, let me know!
I don't have a strong opinion either way. The |
ailzhang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
I think this is good to go after adding a test for hub.load(source='local') API in https://github.com/pytorch/pytorch/blob/master/test/test_utils.py#L585.
adcc61b to
19d603d
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Codecov Report
@@ Coverage Diff @@
## master #44204 +/- ##
=======================================
Coverage 67.85% 67.85%
=======================================
Files 384 384
Lines 50020 50026 +6
=======================================
+ Hits 33942 33947 +5
- Misses 16078 16079 +1
Continue to review full report at Codecov.
|

Fixes #43622
torch.hub.load()into a newtorch.hub._load_local()torch.hub._load_local()function that takes in a path to a local directory that contains ahubconf.pyinstead of a repo name.Refactorstorch.hub.load()so that it now callstorch.hub.load_local()after downloading and extracting the repo.torch.hub.load()so that it can now take in a local path instead of a repo name. Adds asource='github'|'local'param to choose between the two behaviors.torch.hubdocs to include the new function + minor fixes.