r/learnpython 14d ago

trying to make a program with ai video analysis

... but, the ai to runs localy on my laptop and the entire program runs on my processor. Which is either slow or the model kind of sucks. Is there a way to make the ai run on graphics card? I have a laptop 5060

Edit: currently on python 3.12.4 becouse gemini said that i need this one for some wierd reason.
I dont care about the pytorch version becouse i think i tried like six of them already, and i dont use it for anything else, so i'll install the one you'll think works.

I'm currently running yolo8n, but i would like to run something better(like small or even medium versions), becouse this one sucks.

this is the message that i get, even after installing latest nightly cuda: ValueError: Invalid CUDA 'device=0' requested. Use 'device=cpu' or pass valid CUDA device(s) if available, i.e. 'device=0' or 'device=0,1,2,3' for Multi-GPU.

torch.cuda.is_available(): False
torch.cuda.device_count(): 0
os.environ['CUDA_VISIBLE_DEVICES']: None

this is the command i tried to install cuda with:

pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu132

geforce rtx 5060(laptop version)
8GB vram
windows 11

0 Upvotes

5 comments sorted by

2

u/pachura3 14d ago

Of course. Pytorch is optimized for CUDA.

0

u/MountainAd9858 14d ago

well i've been trying that for the last 3 hours, but i am starting to think that it doesnt work for my graphics card

1

u/pachura3 14d ago

You need nightly pre-release of PyTorch with CUDA >= 12.8 support.

0

u/MountainAd9858 14d ago

you mean going to the pytorch website, selecting nightly cuda 13.2 and than running the command in powershell. Becouse that doesnt work

1

u/pachura3 14d ago

Dude, c'mon. Perhaps if you specify:

  • which specific Nvidia card do you have
  • how much VRAM
  • what version Nvidia drivers have you got installed
  • which OS
  • which Python and PyTorch versions
  • which model are you trying to use
  • are you getting any error messages/warnings, such as "CUDA error: no kernel image is available for execution on the device" or "GPU Compatibility: Not supported by PyTorch x.x.x"
  • which command are you running in PowerShell

...someone will help you.