当前位置:   article > 正文

MARS(nerfstudio)安装——RTX4060, CUDA12.0&&11.8, Pytorch2.0.1,Windows11_4060装pytorch 选cuda

4060装pytorch 选cuda

一开始的环境是:CUDA12.0,创建了个pytorch-gpu虚拟环境(pip安装的gpu-torch2.0.1),后来发现在编译tiny_cuda_nn过程出现pytorch2.0.1(CUDA11.8)与检测到的已安装的CUDA12.0不匹配,于是安装了CUDA11.8(不需要卸载12.0,去下载CUDA11.8安装过程只选择CUDA选项即可,系统是可以存在多个CUDA的,只需显卡驱动支持所有CUDA或保持最新就行)参考链接:在windows上安装多个cuda版本 - 知乎

于是就有了两个版本:

查看环境变量应该是有如下两个版本的路径:

当11.8的两个环境变量在前面,系统nvcc -V查看时就是11.8:

同理,当12.0的两个环境变量在前面,系统nvcc -V查看时就是12.0(可以自行安装好之后去验证一下)


接下来介绍下安装过程遇到的问题:

  1. conda create --name nerfstudio -y python=3.8
  2. conda activate nerfstudio
  3. python -m pip install --upgrade pip
  4. pip install --upgrade pip setuptools

这一步都没问题。

主要问题在下面过程中:

This section will walk you through the installation process. Our system is dependent on the nerfstudio project.

1.Install tiny-cuda-nn firstly.

  1. $ git clone --recursive https://github.com/nvlabs/tiny-cuda-nn
  2. $ cd tiny-cuda-nn

Then, use CMake to build the project: (on Windows, this must be in a developer command prompt)这里我安装了VS2022(把C++组件选项安装),之后就会有了:

  1. tiny-cuda-nn$ cmake . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
  2. tiny-cuda-nn$ cmake --build build --config RelWithDebInfo -j

这两步过程中需要注意编译失败(失败原因应该能自己解决)后,把构建的build删了再编译,免得找不到方向。

接下来:也就是在这里遇到了CUDA的问题(不清楚为什么CUDA 12.0不兼容11.8的torch,目前pytorch稳定版最高的对应CUDA版本才11.8,所以就安装了另一个版本)注意:我的出现了The installed version of Nsight Visual Studio Edition is newer than the one to be installed. To reinstall, or change the Nsight configuration, first uninstall Nsight and then reinstall.这段话,其实没有必要管它,已经完成了安装。然后就开始install了:

  1. tiny-cuda-nn$ cd bindings/torch
  2. tiny-cuda-nn/bindings/torch$ python setup.py install

上图成功安装好~

最后可以自行测试

tiny-cuda-nn$ ./build/mlp_learning_an_image data/images/albert.jpg data/config_hash.json

2.Install MARS locally with:

  1. git clone git@github.com:OPEN-AIR-SUN/mars.git #下载不了直接下压缩包
  2. cd mars/nerfstudio
  3. pip install -e .[dev] # install nerfstudio and its dependencies
  4. 可以在后面加上源 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
  5. cd ..
  6. pip install -e .
  7. ns-install-cli # optional, only for tab completion

这个过程主要遇到了在pip install -e .[dev]时出现下面错误:

然后我的解决方法是更新pip和setuptools然后再安装时加上源:

  1. python -m pip install --upgrade pip
  2. pip install --upgrade pip setuptools
  3. pip install -e .[dev] -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

 即可~

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/434334
推荐阅读
相关标签
  

闽ICP备14008679号