Skip to content

Conversation

@ailzhang
Copy link
Contributor

fixes #27844

# To check if cached repo exists, we need to normalize folder names.
repo_dir = os.path.join(hub_dir, '_'.join([repo_owner, repo_name, branch]))
normalized_br = branch.replace('/', '_')
repo_dir = os.path.join(hub_dir, '_'.join([repo_owner, repo_name, normalized_br]))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the replace trick here works in a portable way; should we look into e.g. os.sep or how other folks handle this normalization?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we can just hash the branch name if there is no reason why we should keep the original naming around.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point about windows! ;) Yea I'll switch to os.sep and try to make a test for it.

We might prefer to keep the branch name so that we can reuse cache, hashing will make the cache not discoverable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh actually I just tried, github doesn't allow backslash in branch name, so we are good here. ;)

@ailzhang ailzhang requested a review from soumith October 16, 2019 21:48
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@facebook-github-bot
Copy link
Contributor

@ailzhang merged this pull request in d2eceee.

thiagocrepaldi pushed a commit to thiagocrepaldi/pytorch that referenced this pull request Feb 4, 2020
Summary:
fixes pytorch#27844
Pull Request resolved: pytorch#27960

Differential Revision: D17964360

Pulled By: ailzhang

fbshipit-source-id: f5054fc251d2ebbf09ea4ea9fa4d1ce87db5fc52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

torch.hub does not handle tags and branches with path separator (e.g. "/") in them

5 participants