-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Closed
Copy link
Labels
module: hubtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Bug
torch.hub treats tag or branch names as file paths; if the tag or branch has a path separator (e.g. "/" on Linux) in it e.g. branch ìssues/4 as in
torch.hub.list("moabitcoin/ig65m-pytorch:issues/4")
then torch hub integration fails e.g. see
>>> torch.hub.list("moabitcoin/ig65m-pytorch:issues/4")
Downloading: "https://github.com/moabitcoin/ig65m-pytorch/archive/issues/4.zip" to /root/.cache/torch/hub/issues/4.zip
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/torch/hub.py", line 272, in list
repo_dir = _get_cache_or_reload(github, force_reload, True)
File "/usr/local/lib/python3.6/dist-packages/torch/hub.py", line 153, in _get_cache_or_reload
download_url_to_file(url, cached_file, progress=False)
File "/usr/local/lib/python3.6/dist-packages/torch/hub.py", line 398, in download_url_to_file
f = tempfile.NamedTemporaryFile(delete=False, dir=dst_dir)
File "/usr/lib/python3.6/tempfile.py", line 690, in NamedTemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "/usr/lib/python3.6/tempfile.py", line 401, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: '/root/.cache/torch/hub/issues/tmpq24habt0'
To Reproduce
Steps to reproduce the behavior:
- add a simple hubconf.py to your repository
- create a tag or branch with a path separator in its name
- use torch hub functionality with that tag or branch
Expected behavior
torch.hub works with arbitrary git tags and branches
Environment
env
Collecting environment information...
PyTorch version: 1.3.0
Is debug build: No
CUDA used to build PyTorch: 10.1.243
OS: Ubuntu 18.04.3 LTS
GCC version: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
CMake version: Could not collect
Python version: 3.6
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
Versions of relevant libraries:
[pip3] numpy==1.17.2
[pip3] torch==1.3.0
[pip3] torchvision==0.4.1
[conda] Could not collect
Additional context
Workaround: create a tag or branch alias without the path separator in it.
cc @ailzhang
Metadata
Metadata
Assignees
Labels
module: hubtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module