配置yolov5 报错:ImportError: cannot import name 'amp' from 'torch.nn'
代码中from torch.nn import amp 中的amp是报红的,有一篇帖子讲到说版本原因,建议把train.py的from torch.cuda import amp修改为:from apex import amp
操作以后出现新的问题,暂时无法解决:
ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)
于是我又查找资料,说是关于c++包的问题,需要从NVIDIA的github安装apex库
按照安装命令:
git clone https://github.com/NVIDIA/apex
cd apex
# 同时安装C++扩展
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
# Apex 同样支持 Python-only build (required with Pytorch 0.4) via
pip install -v --no-cache-dir ./
可我安装又出现了错误
ERROR: Command errored out with exit status 1: 'D:\Anaconda3-2019.10\envs\yolo\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\shu_202\AppDat
a\Local\Temp\pip-req-build-0sf4_zk9\setup.py'"'"'; file='"'"'C:\Users\shu_202\AppData\Local\Temp\pip-req-build-0sf4_zk9\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"'
, open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(comp
ile(code, file, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record 'C:\Users\shu_202\AppData\Local\Temp\pip-record-wwrlb9aj\install-record.txt' --single-version-externally-mana
ged --compile --install-headers 'D:\Anaconda3-2019.10\envs\yolo\Include\apex' Check the logs for full command output.
实在无法解决了……
请问大佬们有没有现成的yolov5的anaconda虚拟环境包,可以发我一份吗?感谢!