#🔒 How do I get compatible version for my project to install CPU-only version of PyTorch?

27 messages · Page 1 of 1 (latest)

harsh oyster
#
import speech_recognition as sr

listener = sr.Recognizer()

def takecommand():
    try:
        with sr.Microphone() as source:
            print("Listening...")
            voice = listener.listen(source)
            command = listener.recognize_whisper(voice)
            print(f"You said: {command}")
            return command
    except Exception as e:
        print("Failed to listen. Error:", e)
        return None

takecommand()

Trying to run this code but is resulting in Failed to listen. Error: [WinError 126] The specified module could not be found. Error loading "C:\Users\ikabb\AppData\Local\Programs\Python\Python312\Lib\site-packages\torch\lib\caffe2_nvrtc.dll" or one of its dependencies.

Phind first said I need to install CUDA but I have an AMD system so NVIDIA products won't work. Then Phind told em to use CPU-Only PyTorch libraries and told me to run this in terminal: pip install torch==1.10.0+cpu torchvision==0.11.1+cpu torchaudio===0.10.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html but it has told me to replace the version numbers with the ones compatible for my project. Any idea how I get the compatible version numbers of my project and how to change it accordingly?

[This may be a dumb question, but I'm fairly new to Python, so yeah, sorry ;-; ]

frigid thornBOT
#

@harsh oyster

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

sage geyser
#

did you remove the pytorch before installing the cpu variant?

harsh oyster
sage geyser
#

no problem .. let me know if that doesn't fix it

harsh oyster
#

still not working

#

@sage geyser (sorry for pinging)

chilly badger
#

so take 2.2.2+cpu.

chilly badger
#

(for comparison, 1.10.0 is a 3-year-old version and is compatible with up to python 3.9)

harsh oyster
#

okay

#

i think im understanding now

#

so now i think i need to install torchvision too

chilly badger
#

or do you have an AMD GPU?

harsh oyster
#

I have an AMD GPU

chilly badger
#

in that case, you should ideally use it, GPUs are much faster than CPUs for neural networks. Torch's support for ROCm (AMD's analogue of nvidia's CUDA) is a bit experimental but it exists.

#

see https://pytorch.org/get-started/locally/, it should be as simple as specifying the right link when installing.
(oh, and uninstall the versions you have installed first - it'd be bad if you get a mix of cpu-only and rocm versions of the packages)

chilly badger
harsh oyster
#

okay so i installed torchvision as well with advice from another dude

harsh oyster
harsh oyster
chilly badger
frigid thornBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.