ImportError: cannot import name 'swin3d_b' from 'torchvision.models.video' (/usr/local/lib/python3.10/dist-packages/torchvision/models/video/__init__.py)

Marcus_Wong: <p>torch : 1.13.1+cu117<br>
torchvision : 0.14.1+cu117<br>
Python: 3.10.6<br>
Env: WSL2</p>
<p>After running below :</p>
<pre><code class="lang-auto">import torch
from torch import hub
# resnet18_model = hub.load('pytorch/vision:master', 
#                           'resnet18',
#                           pretrained=True)
from torchvision import models
resnet18_model = hub.load('pytorch/vision:main', 
                          'resnet18',
                          weights=models.ResNet18_Weights.DEFAULT)
</code></pre>
<p>Error:</p>
<pre><code class="lang-auto">Using cache found in /root/.cache/torch/hub/pytorch_vision_main
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[46], line 7
      3 # resnet18_model = hub.load('pytorch/vision:master', 
      4 #                           'resnet18',
      5 #                           pretrained=True)
      6 from torchvision import models
----&gt; 7 resnet18_model = hub.load('pytorch/vision:main', 
      8                           'resnet18',
      9                           weights=models.ResNet18_Weights.DEFAULT)

File /usr/local/lib/python3.10/dist-packages/torch/hub.py:542, in load(repo_or_dir, model, source, trust_repo, force_reload, verbose, skip_validation, *args, **kwargs)
    538 if source == 'github':
    539     repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, trust_repo, "load",
    540                                        verbose=verbose, skip_validation=skip_validation)
--&gt; 542 model = _load_local(repo_or_dir, model, *args, **kwargs)
    543 return model

File /usr/local/lib/python3.10/dist-packages/torch/hub.py:569, in _load_local(hubconf_dir, model, *args, **kwargs)
    566 sys.path.insert(0, hubconf_dir)
    568 hubconf_path = os.path.join(hubconf_dir, MODULE_HUBCONF)
--&gt; 569 hub_module = _import_module(MODULE_HUBCONF, hubconf_path)
    571 entry = _load_entry_from_hubconf(hub_module, model)
    572 model = entry(*args, **kwargs)

File /usr/local/lib/python3.10/dist-packages/torch/hub.py:90, in _import_module(name, path)
     88 module = importlib.util.module_from_spec(spec)
     89 assert isinstance(spec.loader, Loader)
---&gt; 90 spec.loader.exec_module(module)
     91 return module

File &lt;frozen importlib._bootstrap_external&gt;:883, in exec_module(self, module)

File &lt;frozen importlib._bootstrap&gt;:241, in _call_with_frames_removed(f, *args, **kwds)

File ~/.cache/torch/hub/pytorch_vision_main/hubconf.py:74
     72 from torchvision.models.swin_transformer import swin_b, swin_s, swin_t, swin_v2_b, swin_v2_s, swin_v2_t
     73 from torchvision.models.vgg import vgg11, vgg11_bn, vgg13, vgg13_bn, vgg16, vgg16_bn, vgg19, vgg19_bn
---&gt; 74 from torchvision.models.video import (
     75     mc3_18,
     76     mvit_v1_b,
     77     mvit_v2_s,
     78     r2plus1d_18,
     79     r3d_18,
     80     s3d,
     81     swin3d_b,
     82     swin3d_s,
     83     swin3d_t,
     84 )
     85 from torchvision.models.vision_transformer import vit_b_16, vit_b_32, vit_h_14, vit_l_16, vit_l_32

ImportError: cannot import name 'swin3d_b' from 'torchvision.models.video' (/usr/local/lib/python3.10/dist-packages/torchvision/models/video/__init__.py)
</code></pre>

ptrblck: <p>Double post from <a href="https://discuss.pytorch.org/t/problem-with-loading-models-from-torch-hub-pytorch-vision-in-pytest/170320/4">here</a>.</p>