openvinotoolkit / anomalib

An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
https://anomalib.readthedocs.io/en/latest/
Apache License 2.0
3.41k stars 616 forks source link

[Task]: GPU is False #2068

Closed microchila closed 1 month ago

microchila commented 1 month ago

What is the motivation for this task?

Why is my Pytorch's CUDA false after installing, how can I install it to use the GPU version

Describe the solution you'd like

I'm trying to get him to train on the GPU, but after installing it says GPU unavailable!

Additional context

No response

samet-akcay commented 1 month ago

How do you install anomalib?

microchila commented 1 month ago

[22:07:29] Installation list: ['pytest-cov', 'anomalib', 'pytest-sugar', 'sphinx-autodoc-typehints', 'notebook', 'lightning>=2.2', 'jsonargparse>=4.27.7', 'docstring-parser', 'pandoc', install.py:73 'tensorboard', 'pytest', 'matplotlib>=3.4.3', 'rich>=13.5.2', 'pandas>=1.1.0', 'sphinx-book-theme', 'torchmetrics>=1.3.2', 'nbsphinx', 'anomalib', 'timm<=0.9.16,>=0.5.4',
'coverage', 'imgaug==0.4.0', 'av>=10.0.0', 'onnx>=1.16.0', 'gradio>=4', 'tox', 'ipywidgets', 'openvino-dev>=2023.1', 'nncf>=2.6.0', 'omegaconf>=2.1.1', 'gitpython',
'comet-ml>=3.31.7', 'rich-argparse', 'pytest-xdist', 'myst-parser', 'kornia>=0.6.6', 'wandb<=0.15.9,>=0.12.17', 'pre-commit', 'open-clip-torch>=2.23.0',
'opencv-python>=4.5.3.56', 'sphinx-copybutton', 'mlflow>=1.0.0', 'ipykernel', 'pytest-mock', 'sphinx-design', 'freia>=0.2', 'einops>=0.3.2', 'sphinx<8.0', '--extra-index-url',
'https://download.pytorch.org/whl/cpu', 'torch>=2+cpu', 'torchvision>=0.16.2'] is CPU

microchila commented 1 month ago

1.git 2.cd 3.pip install -e . 4.anomalib install @samet-akcay

samet-akcay commented 1 month ago

Are you on windows or linux? Also what is the output of nvcc --version?

abc-125 commented 1 month ago

'https://download.pytorch.org/whl/cpu', 'torch>=2+cpu'

I think you need to install PyTorch with GPU. You can look here to find one that matches your CUDA version. To find which CUDA version you have, use nvcc --version.

samet-akcay commented 1 month ago

anomalib install looks whether cuda and cudnn are installed, and decides which torch version to install. My suspicion is that cuda or cudnn may not properly be installed on the system so anomalib cannot find the gpu information

microchila commented 1 month ago

My cuda was installed on the pytorch official site using the command line, not a separate installation, and I think that's why it doesn't recognise my cuda. I've uninstalled the cpu version of torch and replaced it with the GPU version and it works now.