PeterH0323/Smart_Construction

pytorch版本问题

RFHzhj opened this issue · 4 comments

您好博主,在进行推理时,使用CPU没问题,使用GPU时会报错,错误如下:
UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
return torch._C._cuda_getDeviceCount() > 0
Traceback (most recent call last):
File "area_detect.py", line 170, in
detect()
File "area_detect.py", line 17, in detect
device = torch_utils.select_device(opt.device)
File "/home/rfh/Smart_Construction-master/utils/torch_utils.py", line 30, in select_device
assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device # check availablity
AssertionError: CUDA unavailable, invalid device 2 requested

torch==1.5.1,cuda是10.0版本,想问下是什么问题?是pytorch和cuda版本不匹配吗?

用 conda 安装 cuda toolkit == 10.0

用 conda 安装 cuda toolkit == 10.0

谢谢回复,问题已经解决了

感谢您的支持,如果本项目帮到您请帮我点个 🌟 , Thx!

用 conda 安装 cuda toolkit == 10.0

谢谢回复,问题已经解决了

发生异常: AssertionError
CUDA unavailable, invalid device 0 requested
  File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\utils\torch_utils.py", line 30, in select_device
    assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device  # check availablity
  File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\detect_visual.py", line 54, in load_model
    device = torch_utils.select_device(device)
  File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\detect_visual.py", line 41, in __init__
    self.model, self.half, self.names, self.colors, self.device = self.load_model()
  File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\visual_interface.py", line 115, in __init__
    self.predict_model = YOLOPredict(weight_path, out_file_path)
  File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\visual_interface.py", line 256, in __init__
    self.predict_handler_thread = PredictHandlerThread(self.input_player,
  File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\visual_interface.py", line 471, in <module>
    main_window = MainWindow(weight_root, out_file_root, real_time_show_predict)
AssertionError: CUDA unavailable, invalid device 0 requested

我报这个错,已经安装了cudatoolkit=10.2,不知道怎么还是不能用GPU,只能CPU