yolov5遇到的问题-在anaconda 虚拟环境中安装pytorch,cuda
- 问题一:TypeError: vars() argument must have __dict__ attribute
- 问题二:AssertionError: CUDA unavailable, invalid device 0 requested
- 问题:>>> import torch,torch.cuda.is_available()==False
- 在anaconda 虚拟环境中安装pytorch
- 问题:Exception: You need either charset_normalizer or chardet installed
- 方法
- 问题:RuntimeError: DataLoader worker (pid(s) 19340, 21256, 7988, 8180, 17600, 10208, 14972, 16948) exited unexpectedly
- 问题:OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
- 问题:TypeError: No loop matching the specified signature and casting was found for ufunc greater
问题一:TypeError: vars() argument must have dict attribute
解决办法:
问题二:AssertionError: CUDA unavailable, invalid device 0 requested
cuda不可用报错,现实没有有效的驱动可使用
解决方案
1、测试cuda是否配置正确
1)在终端输入
python3
import torch
print(torch.cuda.is_available())
运行后输出的是False,说明cuda有问题。
继续找问题:有可能是pytorch的版本是cpu版本不是cuda版本的!
方法:查看torch的版本:
python
import torch
print(torch.version)
1.13.1+cpu
接下来安装cuda版本的torch—这里我是在线安装
1:查看cuda版本:nvidia-smi【注意这不是查看anaconda中的cuda版本】
nvidia-smi
查看anaconda环境中cuda的版本号:
nvcc --version:
3.输入如下指令查看是否安装CUDA
nvcc -V
若安装完成显示下图
3. 查看cudnn版本
import torch
print(torch.backends.cudnn.version())
下图显示:None,表示未安装成功。
问题:>>> import torch,torch.cuda.is_available()==False
cmd中检查cuda及cudnn是否成功安装及其版本
- 在cmd中检查cuda是否安装成功:nvcc -V
原文链接:https://blog.csdn.net/qq_40968179/article/detai