Pytorch3d
依赖Requirements
操作系统
以下任一:
- Linux
- macOS
- Windows
cuda
因为需要用GPU,当然必须安装了。
查看cuda版本 nvidia-smi
,我使用的环境是win 11,安装NVIDIA Studio自动安装的是12.1。
一些注意点:
- CUDA版本必须 > 9.2,同时要和pytorch一致
- 如果要使用早于 11.7 的 CUDA,并且您正在从源代码构建,则 CUB 库必须可用。建议使用 1.10.0 版。
Python相关
python 必须是其中一个:3.8、3.9、3.10,我使用的是3.8。
conda create -n pytorch3d python=3.8
conda activate pytorch3d
pytorch & torchvision
pytorch 必须是其中一个:1.12.0, 1.12.1, 1.13.0, 2.0.0, 2.0.1 or 2.1.0。
和前面的CUDA要一致,这里是 cu121
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 --no-cache-dir
depend: fvcore & ioPath
pip install -U fvcore --no-cache-dir
pip install -U iopath --no-cache-dir
pip install ninja
编译相关
- gcc & g++ ≥ 4.9
sudo apt install -y gcc g++
安装:源码
已经构建的比较旧,不适合。因此,只能从源码安装。
git clone https://github.com/facebookresearch/pytorch3d.git
cd pytorch3d && pip install -e .