Torch not compiled with CUDA enabled

By | 2025년 2월 19일
Table of Contents

Torch not compiled with CUDA enabled

NVIDIA GPU 가 있지만 CUDA 가 를 지원하는 Torch 가 설치되어 있지 않은 상황이다.

드라이버 설치 확인

드라이버가 정상적으로 설치되어 있으면 아래와 같이 명령을 입력했을 때 결과가 나온다.

nvidia-smi
......
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.94                 Driver Version: 560.94         CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                  Driver-Model | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1060 3GB  WDDM  |   00000000:01:00.0  On |                  N/A |
| 37%   26C    P8              9W /  130W |     664MiB /   3072MiB |      2%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
......

설치 가능한 CUDA 버전 확인하기

위 명령에서 GTX 1060 이 설치되어 있고, 아래 링크에서 보면 CUDA 8.0 이후 버전을 전부 지원한다.

링크

PyTorch 와 호환되는 CUDA 버전 확인

아래 링크에서 보면 CUDA 12.6 (2025-02 기준) 이 최신버전이다.

링크

Run this Command: 에 있는 명령을 실행해 준다.

CUDA 가 설치되어 있지 않아도 설치가 가능하다.

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126

CUDA 설치

링크

위 링크에서 CUDA 12.6 를 다운받아 설치한다.

오류 대응

오류 내용은 bitsandbytes 오류인데, 오류 해결은 PyTorch 재설치입니다.
PyTorch 가 설치는 되어 있지만 CUDA 버전이 호환되지 않아서 GPU 를 인식하지 못하고,
결국 bitsandbytes 가 실행이 되지 않는 상황이다.

RuntimeError: CUDA is required but not available for bitsandbytes. Please consider installing the multi-platform enabled version of bitsandbytes, which is currently a work in progress. Please check currently supported platforms and installation instructions at https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend

답글 남기기