Make torchhub more robust regarding the master -> main renaming in other repos #63753
Labels
module: hub
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Note: just to clarify, we'll probably have to udpate the https://github.com/pytorch/hub repo to use
main
instead ofmaster
soon, but this issue isn't about this.A lot of repos are moving away from the
master
branch name in favour of themain
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
tomain
, themaster
branch will eventually become outdated, and the models that get downloaded with the default parameters totorch.hub.load()
will be outdated too. Some repos may even delete theirmaster
branch.I think we could change the default branch assumption to the following:
This new assumption might break for repos where the
main
branch exists while the development actually happens onmaster
, 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
The text was updated successfully, but these errors were encountered: