项目场景:
复现pixel2style2pixe
GitHub:https://github.com/eladrich/pixel2style2pixel
问题描述:
1.subprocess.CalledProcessError: Command’[‘ninja‘, ‘-v‘]’returned non-zero exit status 1
以下方案可完美解决
https://wanghao.blog.csdn.net/article/details/120947224
https://blog.csdn.net/weixin_43731803/article/details/116787152
2.no module named ‘fused’
①作者提到过GCC版本太低,但更新至7.5仍出现该问题,排除选项。
②https://blog.csdn.net/c2a2o2/article/details/120596305
链接中第一个思路,将相关函数替换成pytorch的实现方法,避免编译问题,亲测无效,排除选项。
③最后发现问题是cuda版本必须大于等于10.1。
解决方案:
nvcc -V #查看cuda的版本号
注:不要用nvidia-smi命令查看的是cuda版本号,该命令显示的是驱动的版本。
切换cuda版本操作如下:
https://blog.csdn.net/u013905398/article/details/103799621
最后根据以下链接确定torch + torchvision的版本并安装
https://blog.csdn.net/jorg_zhao/article/details/106883420
比如我的环境python3.6 + cuda10.1
pip install torch==1.7.0 torchvision==0.8.0
注:建议修改完cuda后重新安装torch,作者提到有可能默认使用之前编译的文件导致失败。