<p dir="auto">Dear all, for some reason, I recently started to have problems with torchvision, although it looks like I haven't changed anything recently.</p>
<p dir="auto">Do you have any idea what happened ?<br>
Thank you in advance for your help</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    import segmentation_models_pytorch as smp
  File &quot;/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/__init__.py&quot;, line 1, in &lt;module&gt;
    from .unet import Unet
  File &quot;/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/unet/__init__.py&quot;, line 1, in &lt;module&gt;
    from .model import Unet
  File &quot;/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/unet/model.py&quot;, line 3, in &lt;module&gt;
    from ..encoders import get_encoder
  File &quot;/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/encoders/__init__.py&quot;, line 4, in &lt;module&gt;
    from .resnet import resnet_encoders
  File &quot;/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/encoders/resnet.py&quot;, line 28, in &lt;module&gt;
    from torchvision.models.resnet import ResNet
  File &quot;/usr/local/lib/python3.6/dist-packages/torchvision/__init__.py&quot;, line 5, in &lt;module&gt;
    from torchvision import models
  File &quot;/usr/local/lib/python3.6/dist-packages/torchvision/models/__init__.py&quot;, line 12, in &lt;module&gt;
    from . import detection
  File &quot;/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/__init__.py&quot;, line 1, in &lt;module&gt;
    from .faster_rcnn import *
  File &quot;/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/faster_rcnn.py&quot;, line 7, in &lt;module&gt;
    from torchvision.ops import misc as misc_nn_ops
  File &quot;/usr/local/lib/python3.6/dist-packages/torchvision/ops/__init__.py&quot;, line 1, in &lt;module&gt;
    from .boxes import nms, box_iou
  File &quot;/usr/local/lib/python3.6/dist-packages/torchvision/ops/boxes.py&quot;, line 43, in &lt;module&gt;
    @torch.jit._script_if_tracing
AttributeError: module 'torch.jit' has no attribute '_script_if_tracing'"><pre class="notranslate"><code class="notranslate">    import segmentation_models_pytorch as smp
  File "/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/__init__.py", line 1, in &lt;module&gt;
    from .unet import Unet
  File "/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/unet/__init__.py", line 1, in &lt;module&gt;
    from .model import Unet
  File "/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/unet/model.py", line 3, in &lt;module&gt;
    from ..encoders import get_encoder
  File "/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/encoders/__init__.py", line 4, in &lt;module&gt;
    from .resnet import resnet_encoders
  File "/usr/local/lib/python3.6/dist-packages/segmentation_models_pytorch/encoders/resnet.py", line 28, in &lt;module&gt;
    from torchvision.models.resnet import ResNet
  File "/usr/local/lib/python3.6/dist-packages/torchvision/__init__.py", line 5, in &lt;module&gt;
    from torchvision import models
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/__init__.py", line 12, in &lt;module&gt;
    from . import detection
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/__init__.py", line 1, in &lt;module&gt;
    from .faster_rcnn import *
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/faster_rcnn.py", line 7, in &lt;module&gt;
    from torchvision.ops import misc as misc_nn_ops
  File "/usr/local/lib/python3.6/dist-packages/torchvision/ops/__init__.py", line 1, in &lt;module&gt;
    from .boxes import nms, box_iou
  File "/usr/local/lib/python3.6/dist-packages/torchvision/ops/boxes.py", line 43, in &lt;module&gt;
    @torch.jit._script_if_tracing
AttributeError: module 'torch.jit' has no attribute '_script_if_tracing'
</code></pre></div>
<p dir="auto">Which versions am I using:</p>
<blockquote>
<p dir="auto">pip freeze | grep torch<br>
efficientnet-pytorch==0.6.3<br>
segmentation-models-pytorch==0.1.0<br>
torch==1.4.0<br>
torchvision==0.5.0</p>
</blockquote>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/suo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/suo">@suo</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gmagogsfm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gmagogsfm">@gmagogsfm</a></p>
<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<p dir="auto">Error using the pytorch.hub API:<br>
code:</p>
<p dir="auto">import torch<br>
from torch import hub<br>
resnet18_model = hub.load('pytorch/vision:master','resnet18',pretrained=True)</p>
<h2 dir="auto">Error</h2>
<hr>
<h2 dir="auto">Downloading: "<a href="https://github.com/pytorch/vision/archive/master.zip">https://github.com/pytorch/vision/archive/master.zip</a>" to /home/pratik/.cache/torch/hub/master.zip</h2>
<p dir="auto">AttributeError                            Traceback (most recent call last)<br>
in<br>
3 resnet18_model = hub.load('pytorch/vision:master',<br>
4 'resnet18',<br>
----&gt; 5 pretrained=True)</p>
<p dir="auto">~/anaconda3/lib/python3.7/site-packages/torch/hub.py in load(github, model, *args, **kwargs)<br>
363     sys.path.insert(0, repo_dir)<br>
364<br>
--&gt; 365     hub_module = import_module(MODULE_HUBCONF, repo_dir + '/' + MODULE_HUBCONF)<br>
366<br>
367     entry = _load_entry_from_hubconf(hub_module, model)</p>
<p dir="auto">~/anaconda3/lib/python3.7/site-packages/torch/hub.py in import_module(name, path)<br>
73         spec = importlib.util.spec_from_file_location(name, path)<br>
74         module = importlib.util.module_from_spec(spec)<br>
---&gt; 75         spec.loader.exec_module(module)<br>
76         return module<br>
77     elif sys.version_info &gt;= (3, 0):</p>
<p dir="auto">~/anaconda3/lib/python3.7/importlib/_bootstrap_external.py in exec_module(self, module)</p>
<p dir="auto">~/anaconda3/lib/python3.7/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)</p>
<p dir="auto">~/.cache/torch/hub/pytorch_vision_master/hubconf.py in<br>
3<br>
4 # classification<br>
----&gt; 5 from torchvision.models.alexnet import alexnet<br>
6 from torchvision.models.densenet import densenet121, densenet169, densenet201, densenet161<br>
7 from torchvision.models.inception import inception_v3</p>
<p dir="auto">~/.cache/torch/hub/pytorch_vision_master/torchvision/<strong>init</strong>.py in<br>
3 from .extension import _HAS_OPS<br>
4<br>
----&gt; 5 from torchvision import models<br>
6 from torchvision import datasets<br>
7 from torchvision import ops</p>
<p dir="auto">~/.cache/torch/hub/pytorch_vision_master/torchvision/models/<strong>init</strong>.py in<br>
10 from .shufflenetv2 import *<br>
11 from . import segmentation<br>
---&gt; 12 from . import detection<br>
13 from . import video<br>
14 from . import quantization</p>
<p dir="auto">~/.cache/torch/hub/pytorch_vision_master/torchvision/models/detection/<strong>init</strong>.py in<br>
----&gt; 1 from .faster_rcnn import *<br>
2 from .mask_rcnn import *<br>
3 from .keypoint_rcnn import *</p>
<p dir="auto">~/.cache/torch/hub/pytorch_vision_master/torchvision/models/detection/faster_rcnn.py in<br>
5 import torch.nn.functional as F<br>
6<br>
----&gt; 7 from torchvision.ops import misc as misc_nn_ops<br>
8 from torchvision.ops import MultiScaleRoIAlign<br>
9</p>
<p dir="auto">~/.cache/torch/hub/pytorch_vision_master/torchvision/ops/<strong>init</strong>.py in<br>
----&gt; 1 from .boxes import nms, box_iou<br>
2 from .new_empty_tensor import _new_empty_tensor<br>
3 from .deform_conv import deform_conv2d, DeformConv2d<br>
4 from .roi_align import roi_align, RoIAlign<br>
5 from .roi_pool import roi_pool, RoIPool</p>
<p dir="auto">~/.cache/torch/hub/pytorch_vision_master/torchvision/ops/boxes.py in<br>
40<br>
41<br>
---&gt; 42 @torch.jit._script_if_tracing<br>
43 def batched_nms(<br>
44     boxes: Tensor,</p>
<h2 dir="auto">AttributeError: module 'torch.jit' has no attribute '_script_if_tracing'</h2>
<h2 dir="auto">Environment</h2>
<hr>
<p dir="auto">PyTorch version: 1.5.0<br>
Is debug build: No<br>
CUDA used to build PyTorch: None</p>
<p dir="auto">OS: Ubuntu 20.04 LTS<br>
GCC version: (Ubuntu 9.3.0-10ubuntu2) 9.3.0<br>
CMake version: version 3.16.3</p>
<p dir="auto">Python version: 3.7<br>
Is CUDA available: No<br>
CUDA runtime version: No CUDA<br>
GPU models and configuration: No CUDA<br>
Nvidia driver version: No CUDA<br>
cuDNN version: No CUDA</p>
<p dir="auto">Versions of relevant libraries:<br>
[pip3] numpy==1.18.0<br>
[pip3] numpydoc==0.9.1<br>
[pip3] torch==1.5.0<br>
[pip3] torchvision==0.6.0a0+82fd1c8<br>
[conda] _tflow_select             2.3.0                       mkl<br>
[conda] blas                      1.0                         mkl<br>
[conda] cpuonly                   1.0                           0    pytorch<br>
[conda] mkl                       2019.4                      243<br>
[conda] mkl-service               2.3.0            py37he904b0f_0<br>
[conda] mkl_fft                   1.0.14           py37ha843d7b_0<br>
[conda] mkl_random                1.1.0            py37hd6b4f25_0<br>
[conda] numpy                     1.16.2                   pypi_0    pypi<br>
[conda] numpy-base                1.17.2           py37hde5b4d6_0<br>
[conda] numpydoc                  0.9.1                      py_0<br>
[conda] pytorch                   1.5.0               py3.7_cpu_0  [cpuonly]  pytorch<br>
[conda] tensorflow-base           2.0.0           mkl_py37h9204916_0<br>
[conda] torchvision               0.6.0                  py37_cpu  [cpuonly]  pytorch</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/suo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/suo">@suo</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gmagogsfm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gmagogsfm">@gmagogsfm</a></p>