ModuleNotFoundError: No module named 'torch._dynamo'

chandhinii: <p>Hi Team,</p>
<p>Im using pytorch for medical image segmentation. My cuda gpu version is 11.4 so I used pytorch previous version compatible for my cuda as follows</p>
<pre><code class="lang-auto"># CUDA 11.3
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch
</code></pre>
<p>I have limitation to upgrade my cuda so I have to install package below 11.4</p>
<p>for this pytorch package I got an error as follows<br>
File “/home/students/studbhara1/nnUNet/nnunetv2/run/load_pretrained_weights.py”, line 2, in <br>
from torch._dynamo import OptimizedModule<br>
ModuleNotFoundError: No module named ‘torch._dynamo’</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/b/2b703507cbbee9a49b3b9cac78889736b276e3ff.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/2b703507cbbee9a49b3b9cac78889736b276e3ff" title="ee2"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2b703507cbbee9a49b3b9cac78889736b276e3ff_2_690x199.jpeg" alt="ee2" data-base62-sha1="6cgVU41L9C34LY1wwxwfpgUbqYD" width="690" height="199" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2b703507cbbee9a49b3b9cac78889736b276e3ff_2_690x199.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2b703507cbbee9a49b3b9cac78889736b276e3ff_2_1035x298.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2b703507cbbee9a49b3b9cac78889736b276e3ff_2_1380x398.jpeg 2x" data-dominant-color="DDDDDD"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">ee2</span><span class="informations">1919×554 53.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>how can I resolve this error as latest version of pytorch dont support cuda 11.3.</p>
<p>Kindly do guide me in this regards</p>

ptrblck: <aside class="quote no-group" data-username="chandhinii" data-post="1" data-topic="193014">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/c/53a042/48.png" class="avatar"> chandhinii:</div>
<blockquote>
<p>My cuda gpu version is 11.4 so I used pytorch previous version compatible for my cuda as follows</p>
</blockquote>
</aside>
<aside class="quote no-group" data-username="chandhinii" data-post="1" data-topic="193014">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/c/53a042/48.png" class="avatar"> chandhinii:</div>
<blockquote>
<p>I have limitation to upgrade my cuda so I have to install package below 11.4</p>
</blockquote>
</aside>
<p>Your locally installed CUDA toolkit won’t be used unless you build PyTorch from source or custom CUDA extensions. If you want to use the new <code>Dynamo</code> util., install the latest release.</p>

chandhinii: <p>I already Installed latest pytorch 2.1.1 but I get runtime error as the Nvidia gpu version is too old (which I cant upgrade due to limitation of access issue) or alternatively downgrade pytorch . So I choose to downgrade pytorch 1.11.0. But this version doesn’t support dynamo.</p>
<p>In such case I would like to know which starting version of pytorch support dynamo as well as compatible with the nvidia version cuda 11.4!!</p>

ptrblck: <aside class="quote no-group" data-username="chandhinii" data-post="3" data-topic="193014">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/c/53a042/48.png" class="avatar"> chandhinii:</div>
<blockquote>
<p>In such case I would like to know which starting version of pytorch support dynamo as well as compatible with the nvidia version cuda 11.4!!</p>
</blockquote>
</aside>
<p>Again, the locally installed CUDA version doesn’t matter, only the NVIDIA driver.<br>
Dynamo support starts with PyTorch 2.0, so you could try to install the binaries shipping with CUDA 11.8 and check if your driver would support these or is also too old.</p>