[파이썬 / VSCode] AssertionError: Torch not compiled with CUDA enabled
-
Yolo v3 모델을 통해 이미지 분류를 하려던 중 해당 에러가 발생하여 진행하지 못했다.
문제의 에러 블럭
command : python3 detect_1231.py --cfg cfg/yolov3-spp-403cls.cfg --names data/403food.names --weights weights/best_403food_e200b150v2.pt
===============================================================
Traceback (most recent call last):
File "C:\Users\dongs\OneDrive\문서\2023-2th\AI_DeepLearning\03.AI알고리즘 소스코드\음식분류\yolov3\detect_1231.py", line 305, in <module>
printOsInfo()
File "C:\Users\dongs\OneDrive\문서\2023-2th\AI_DeepLearning\03.AI알고리즘 소스코드\음식분류\yolov3\detect_1231.py", line 300, in printOsInfo
print('GPU :\t', torch.cuda.get_device_name(0))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\cuda\__init__.py", line 419, in get_device_name
return get_device_properties(device).name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\cuda\__init__.py", line 449, in get_device_properties
_lazy_init() # will define _get_device_properties
^^^^^^^^^^^^
File "C:\Users\dongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\cuda\__init__.py", line 289, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
여러 사이트를 돌아다닌 결과 GPU사용이 활성화 되지 않거나, 내부 라이브러리 버전이 호환되지 않아 그렇다는 것으로 문제를 인식했다.
#Yolo v5 모델에서는 작동을 잘 했기 때문에,
뭐 쿠다에 GPU 활성번호로 입력하면 된다는데, 그런건 모르겠어서 호환 문제로 해결해 보기로 했다.