vocal-remover icon indicating copy to clipboard operation
vocal-remover copied to clipboard

Training with using GPU but it chooses my CPU instead

Open KatieBelli opened this issue 1 year ago • 5 comments

When I use that code: python inference.py --input path/to/an/audio/file --gpu 0 then it uses my CPU instead of my GPU.

I run Ultimate Vocal Remover with choosing GPU and in the task manager I see that it uses my GPU. But when I use Vocal Remover with cmd then it always uses my CPU even if I use the code that's for using GPU.

Do I need to change the code or what else do I need to do to solve this issue?

My GPU: NVIDIA GeForce GTX 1660.

Edit: I already installed PyTorch for CUDA, not CPU.

KatieBelli avatar Feb 12 '23 09:02 KatieBelli

Try the following command. If the output is False, the setup has failed.

python -c "import torch; print(torch.cuda.is_available())"

tsurumeso avatar Feb 19 '23 04:02 tsurumeso

Output is "False" so does that mean I should reinstall Pytorch (for CUDA)?

Just in case this is needed as an information:

C:\Users(...)>nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Tue_May__3_19:00:59_Pacific_Daylight_Time_2022 Cuda compilation tools, release 11.7, V11.7.64 Build cuda_11.7.r11.7/compiler.31294372_0

C:\Users(...)>pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117

Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117 Requirement already satisfied: torch in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (1.12.0) Requirement already satisfied: torchvision in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (0.13.0) Requirement already satisfied: torchaudio in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (0.12.0) Requirement already satisfied: typing-extensions in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from torch) (4.3.0) Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from torchvision) (8.4.0) Requirement already satisfied: requests in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from torchvision) (2.28.1) Requirement already satisfied: numpy in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from torchvision) (1.20.3) Requirement already satisfied: idna<4,>=2.5 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from requests->torchvision) (3.3) Requirement already satisfied: certifi>=2017.4.17 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from requests->torchvision) (2022.6.15) Requirement already satisfied: charset-normalizer<3,>=2 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from requests->torchvision) (2.1.0) Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from requests->torchvision) (1.26.7)

This is the website which I used for the download via cmd: https://pytorch.org/get-started/locally/

KatieBelli avatar Feb 19 '23 14:02 KatieBelli

Yeah. You should reinstall PyTorch. And also, please make sure that the latest version of NVIDIA driver for GTX 1660 is installed.

tsurumeso avatar Feb 20 '23 12:02 tsurumeso

Edit: The latest version of my NVIDIA driver for GTX 1660 is installed: 531.18

It still doesn't work even though I did the following steps (I added more informations about my GPU below):

  • I uninstalled and reinstalled Pytorch using pytorch.org but I'm not sure if it worked correctly:

grafik

C:\Users(...)>pip3 uninstall torch Found existing installation: torch 1.12.0 Uninstalling torch-1.12.0: Would remove: c:\users(...)\appdata\local\programs\python\python39\lib\site-packages\caffe2* c:\users(...)\appdata\local\programs\python\python39\lib\site-packages\torch-1.12.0.dist-info* c:\users(...)\appdata\local\programs\python\python39\lib\site-packages\torch* c:\users(...)\appdata\local\programs\python\python39\lib\site-packages\torchgen* c:\users(...)\appdata\local\programs\python\python39\scripts\convert-caffe2-to-onnx.exe c:\users(...)\appdata\local\programs\python\python39\scripts\convert-onnx-to-caffe2.exe c:\users(...)\appdata\local\programs\python\python39\scripts\torchrun.exe Proceed (Y/n)? Y Successfully uninstalled torch-1.12.0

C:\Users(...)>pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117 Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117 Collecting torch Using cached https://download.pytorch.org/whl/cu117/torch-1.13.1%2Bcu117-cp39-cp39-win_amd64.whl (2255.6 MB) Requirement already satisfied: torchvision in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (0.13.0) Requirement already satisfied: torchaudio in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (0.12.0) Requirement already satisfied: typing-extensions in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from torch) (4.3.0) Using cached torch-1.12.0-cp39-cp39-win_amd64.whl (161.8 MB) Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from torchvision) (8.4.0) Requirement already satisfied: numpy in c:\users(...)appdata\local\programs\python\python39\lib\site-packages (from torchvision) (1.20.3) Requirement already satisfied: requests in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from torchvision) (2.28.1) Requirement already satisfied: charset-normalizer<3,>=2 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from requests->torchvision) (2.1.0) Requirement already satisfied: idna<4,>=2.5 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from requests->torchvision) (3.3) Requirement already satisfied: certifi>=2017.4.17 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from requests->torchvision) (2022.6.15) Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users(...)\appdata\local\programs\python\python39\lib\site-packages (from requests->torchvision) (1.26.7) Installing collected packages: torch Successfully installed torch-1.12.0

  • Here are more informations about my GPU:

grafik

C:\Users(...)>nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Wed_Feb__8_05:53:42_Coordinated_Universal_Time_2023 Cuda compilation tools, release 12.1, V12.1.66 Build cuda_12.1.r12.1/compiler.32415258_0

  • I also installed Cuda_12.1.0_531.14_windows.

KatieBelli avatar Mar 05 '23 09:03 KatieBelli

I did a deeper research and I found the solution:

I entered this code:

pip3 install torch== +cu113 torchvision== +cu113 torchaudio== +cu1131.10.1 0.11.2 0.10.1
-f https://download.pytorch.org/whl/cu113/torch_stable.html

Then I did this: https://github.com/ultralytics/yolov3/issues/1643#issuecomment-782741573

Then I changed the number to 2 in the train.py: batchsize default and num_workers default.

Results: It uses my GPU now. Usually I had to wait about 20-35 minutes for each epoch but now it's not even 10 minutes per epoch.

Thanks for your help, tsurumeso.

tsurumeso, maybe you can tell me if it's somehow damaging for my GPU if I train new models with it? It was just a thought that came into my mind and I know very little about computers.

KatieBelli avatar Mar 07 '23 09:03 KatieBelli