Ask questionsAttributeError: module 'torch.jit' has no attribute 'unused'

🐛 Bug

Error using the pytorch.hub API: code:

entrypoints = torch.hub.list('pytorch/vision', force_reload=True)
Downloading: "" to .../.cache\torch\hub\
Traceback (most recent call last):
  File "..../", line 2, in <module>
    entrypoints = torch.hub.list('pytorch/vision', force_reload=True)
  File "...\.conda\envs\hackaton\lib\site-packages\torch\", line 285, in list
    hub_module = import_module(MODULE_HUBCONF, repo_dir + '/' + MODULE_HUBCONF)
  File "..\.conda\envs\hackaton\lib\site-packages\torch\", line 72, in import_module
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File ".../.cache\torch\hub\pytorch_vision_master/", line 4, in <module>
    from torchvision.models.alexnet import alexnet
  File "..../.cache\torch\hub\pytorch_vision_master\torchvision\", line 1, in <module>
    from torchvision import models
  File "...../.cache\torch\hub\pytorch_vision_master\torchvision\models\", line 6, in <module>
    from .densenet import *
  File "...../.cache\torch\hub\pytorch_vision_master\torchvision\models\", line 22, in <module>
    class _DenseLayer(nn.Module):
  File ".../.cache\torch\hub\pytorch_vision_master\torchvision\models\", line 52, in _DenseLayer
    @torch.jit.unused  # noqa: T484
AttributeError: module 'torch.jit' has no attribute 'unused'

Process finished with exit code 1

cc @ezyang @gchanan @zou3519 @ailzhang @suo


Answer questions colesbury

cc @ailzhang -- I also reported this on


Related questions

TensorBoard logging requires TensorBoard with Python summary writer installed. This should be available in 1.14 or above hot 3
Script freezes with no output when using DistributedDataParallel hot 2
Adding Pixel Unshuffle hot 2
DataLoader leaking Semaphores. hot 2
[feature request] Add matrix exponential hot 2
cublas runtime error on torch.bmm() with CUDA10 and RTX2080Ti hot 2
libtorch does not initialize OpenMP/MKL by default hot 2
Use torch.device() with torch.load(..., map_location=torch.device()) hot 2
Cuda required when loading a TorchScript with map_location='cpu' hot 2
PyTorch 1.5 failed to import c:miniconda3-x64envs estlibsite-packages orchlibcaffe2_nvrtc.dll - pytorch hot 2
Error during import torch, NameError: name &#39;_C&#39; is not defined - pytorch hot 2
Quantisation of object detection models. hot 2
Problems with install python from source hot 2
torch.utils.tensorboard.SummaryWriter.add_graph do not support non-tensor inputs - pytorch hot 2
a retrained and saved jit module could not be reload. hot 2
Github User Rank List