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

Make torchhub more robust regarding the master -> main renaming in other repos #63753

Closed
NicolasHug opened this issue Aug 23, 2021 · 1 comment
Labels
module: hub triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@NicolasHug
Copy link
Member

NicolasHug commented Aug 23, 2021

Note: just to clarify, we'll probably have to udpate the https://github.com/pytorch/hub repo to use main instead of master soon, but this issue isn't about this.


A lot of repos are moving away from the master branch name in favour of the main branch (torchaudio, torchvision, etc.)

Currently, torhhub assumes that the default branch of a repo is the master branch:

https://github.com/pytorch/pytorch/blob/726fd26b3e5ecf205569e59cf7cd5a6cbf4387a0/torch/hub.py#L107:L113

This can be problematic because for repos which have transitioned from master to main, the master branch will eventually become outdated, and the models that get downloaded with the default parameters to torch.hub.load() will be outdated too. Some repos may even delete their master branch.

I think we could change the default branch assumption to the following:

if main exists then use main, else use master

This new assumption might break for repos where the main branch exists while the development actually happens on master, but IMHO this isn't a common-enough scenario to worry about it.

If there are no concerns, I'll try to submit a PR for this next week unless someone else does it (which you are more than welcome to)

cc @nairbv @NicolasHug

@bdhirsh bdhirsh added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Aug 23, 2021
@fmassa
Copy link
Member

fmassa commented Sep 1, 2021

I agree with the proposal, and I think it will make a lot of things easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: hub triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants