Cuda and Pytorch compatibility issue in windows 11, graphics NVIDIA GTX 1650

Arnit_Panda: <p>Can someone guide me the proper installation of cuda, tensorflow and pytorch from beginning with proper compatible versions for my local machine. And which python-version, so that its packages should be compatible with cuda, torch and tensorflow.</p>
<p>±--------------------------------------------------------------------------------------+<br>
| NVIDIA-SMI 536.67                 Driver Version: 536.67       CUDA Version: 12.2     |<br>
|-----------------------------------------±---------------------±---------------------+<br>
| GPU  Name                     TCC/WDDM  | Bus-Id        Disp.A | Volatile Uncorr. ECC |<br>
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |<br>
|                                         |                      |               MIG M. |<br>
|=========================================+======================+======================|<br>
|   0  NVIDIA GeForce GTX 1650      WDDM  | 00000000:01:00.0 Off |                  N/A |<br>
| N/A   44C    P8               7W /  50W |      0MiB /  4096MiB |      0%      Default |<br>
|                                         |                      |                  N/A |<br>
±----------------------------------------±---------------------±---------------------+</p>
<p>±--------------------------------------------------------------------------------------+<br>
| Processes:                                                                            |<br>
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |<br>
|        ID   ID                                                             Usage      |<br>
|=======================================================================================|<br>
|  No running processes found                                                           |<br>
±--------------------------------------------------------------------------------------+</p>

ptrblck: <p>Your GTX 1650, with a compute capability of 7.5, is supported in all currently released PyTorch binaries and you can install the stable or nightly release from <a href="https://pytorch.org/get-started/locally/">here</a>.<br>
You would only need to install an NVIDIA driver (which seems to be the case already) as the binaries ship with their own CUDA dependencies.</p>

Arnit_Panda: <p>I tried for :-<br>
conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.7 -c pytorch -c nvidia</p>
<p>it worked:–</p>
<p>import torch<br>
print(torch.cuda.is_available())</p>
<p>C:\Users\arnit\anaconda3\envs\PyTorch\python.exe C:\Users\arnit\PycharmProjects\pythonProject\main.py<br>
True</p>
<p>but the value comes false when I run a project in D: drive… Can you help me in adding path ?</p>

ptrblck: <p>Sorry, but I’m not familiar enough with your Windows environment and don’t know what might be causing the issue. I would start by checking which environment is used and that the same <code>python.exe</code> from the same <code>PyTorch</code> env is used.</p>

Arnit_Panda: <p>yeah i’ve resolved the issue of compatibility but another issue i’m having:-</p>
<p>E       torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 308.00 MiB (GPU 0; 4.00 GiB total capacity; 5.51 GiB already allocated; 0 bytes free; 5.79 GiB reserved in total by PyTorch) If reserved memory is &gt;&gt; allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF</p>
<p>can you help me in resolving this error? i can’t figure out how to use less memory</p>

ptrblck: <p>You would need to reduce the batch size or use a smaller model to reduce the memory usage.<br>
Alternatively, you could also check <code>torch.utils.checkpoint</code> to trade compute for memory.</p>

Arnit_Panda: <p>Thank you … reducing batch_size worked fine</p>

NIKHIL_GEORGE: <p>you first create an environment in conda with the required python version mostly 3.8.* and then pip3 install instead of conda install inside the environment and then you can use the environment as your python interpreter will use the torch GPU as your kernel in running the program</p>

Soham_Ghosh1: <p>Hey everyone,<br>
I am a fresher. I was trying to do model training of Yolov8m model on my system, that has a GTX 1650. Cuda 12.1 was installed with pytorch and its showing when I do the version check, but still while training the model it is not supporting and the loss values are ‘nan’ and map values are 0. I even tried installing the cuda toolkit 12.3 from Nvidia, still no good. I even tried installing cuda 11.8, still same issue.<br>
Can someone please guide me what the problem is and how I can solve it.<br>
Thank you.</p>

ptrblck: <p>Your locally installed CUDA toolkit won’t be used as PyTorch ships with its own CUDA runtime dependencies. Why do you assume it’s any kind of compatibility issues and not broken training code, as is usually the case when NaN values are returned?</p>

Soham_Ghosh1: <p>Sorry but I am a fresher. When with the same code I tried it on google colab and it worked and the yolo model was trained. But when I am using that code through my system kernel, the model is returning ‘NaN’ values.</p>

ptrblck: <p>This still does not confirm that e.g. exactly the same data and parameters were used.</p>

Soham_Ghosh1: <p>The data is an image set of 178 images with multiple bounding boxes and I am using yolov8m with 100 epochs and batch size of 4. The same I did with colab and cuda 11.8, it ran and was successful. But when I created an environment and installed pytorch and cuda 11.8 on my personal laptop, it was not working. I tried installing cuda older versions, but pytorch didn’t support that. Today, I tried installing pytorch and cuda 11.8 on my friend’s laptop which has rtx 2080, it worked. All this time the same dataset, annotations and .py files were used. So, I wanted to know more about what the problem is and how it can be resolved.</p>

Soham_Ghosh1: <p>I am using the command:</p>
<pre><code class="lang-auto">round(torch.cuda.memory_allocated(0)/1024**3,1)
</code></pre>
<p>and it just returns 0. No memory is allocated. Please help!<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/6/c645138b0f44dfac1142cb59f05933e59a4e39a7.png" data-download-href="https://discuss.pytorch.org/uploads/default/c645138b0f44dfac1142cb59f05933e59a4e39a7" title="Screenshot 2023-12-14 040151"><img src="https://discuss.pytorch.org/uploads/default/original/3X/c/6/c645138b0f44dfac1142cb59f05933e59a4e39a7.png" alt="Screenshot 2023-12-14 040151" data-base62-sha1="shYx8IygIC29MNJRKySIhbKQ06j" width="690" height="359" data-dominant-color="161616"><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">Screenshot 2023-12-14 040151</span><span class="informations">1000×521 17.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>

ptrblck: <p>Why should memory be allocated if you haven’t created any tensors yet?</p>

Soham_Ghosh1: <p>Can you please guide me, how to allocate and reserve memory. It will be very helpful to me.<br>
Yesterday after the conversation with you, I created a tensor. Its showing allocated but reserved is still 0.</p>

ptrblck: <p>Take a look as the <a href="https://pytorch.org/docs/stable/notes/cuda.html#memory-management">memory management docs</a>.</p>

Pranil_Patil: <p>GeForce GTX 1650 is not cuda supported, but 1650 ti is.</p>

ptrblck: <p>That’s not true. Where did you get this information from?</p>

Pranil_Patil: <aside class="onebox allowlistedgeneric" data-onebox-src="https://developer.nvidia.com/cuda-gpus">
  <header class="source">
      <img src="https://dirms4qsy6412.cloudfront.net/assets/favicon-81bff16cada05fcff11e5711f7e6212bdc2e0a32ee57cd640a8cf66c87a6cbe6.ico" class="site-icon" width="48" height="48">

      <a href="https://developer.nvidia.com/cuda-gpus" target="_blank" rel="noopener nofollow ugc">NVIDIA Developer</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:610/345;"><img src="https://d29g4g2dyqv443.cloudfront.net/sites/default/files/styles/610x345/public/externals/94007d76757e49366fe7e91734537dbb.jpg?itok=pTpiIc1K" class="thumbnail" width="610" height="345"></div>

<h3><a href="https://developer.nvidia.com/cuda-gpus" target="_blank" rel="noopener nofollow ugc">CUDA GPUs - Compute Capability</a></h3>

  <p>Explore your GPU compute capability and CUDA-enabled products.</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
<p>
Only mention of 1650ti one. I also tried by installing multiple versions of cuda, subsequently installing pytorch with relevant commands. But gpu was not showing. Then I checked above link.</p>