File size: 2,887 Bytes
ce896ee | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | # ACT 环境 PyTorch3D 安装说明
这个目录提供 ACT 环境使用的 PyTorch3D 预编译 wheel 包,适合在无法直接使用 Docker 镜像时安装。
## 适用环境
- Linux x86_64 服务器
- Python 3.10
- PyTorch 2.2.2 + CUDA 11.8,也就是 `torch==2.2.2+cu118`
- NVIDIA GPU 驱动需要支持 CUDA 11.8
当前 wheel 文件:
```bash
pytorch3d-0.7.8-cp310-cp310-linux_x86_64.whl
```
校验值:
```bash
sha256: b051237f4b099f2f9644c656d7148722b8db0f6a7d02111f67e55b748ac68352
```
## 下载文件
在服务器上安装 Hugging Face CLI:
```bash
pip install -U huggingface_hub
```
下载 ACT requirements 和 PyTorch3D wheel:
```bash
hf download MetaAct/robotwin-act \
--repo-type dataset \
--include "Docker/requirements/robotwin-act-with-code_h20.requirements.txt" \
--include "Docker/requirements/ACT/*" \
--local-dir .
```
下载完成后,文件会在:
```bash
Docker/requirements/robotwin-act-with-code_h20.requirements.txt
Docker/requirements/ACT/pytorch3d-0.7.8-cp310-cp310-linux_x86_64.whl
Docker/requirements/ACT/README.md
```
## 安装顺序
进入你的 ACT Python 环境,例如:
```bash
conda activate RoboTwin
```
先安装 ACT 的普通依赖:
```bash
pip install -r Docker/requirements/robotwin-act-with-code_h20.requirements.txt
```
如果 requirements 里包含 `pytorch3d` 且安装失败,可以先跳过它,最后单独安装下面这个 wheel。
安装 PyTorch3D wheel:
```bash
pip install --no-deps --force-reinstall Docker/requirements/ACT/pytorch3d-0.7.8-cp310-cp310-linux_x86_64.whl
```
`--no-deps` 的作用是只安装 PyTorch3D 本体,不让 pip 自动改动已经装好的 PyTorch/CUDA 相关包。
## 验证安装
运行:
```bash
python - <<'PY'
import torch
import pytorch3d
import pytorch3d._C
from pytorch3d.ops import sample_farthest_points
print("torch:", torch.__version__, "cuda:", torch.version.cuda)
print("pytorch3d:", pytorch3d.__version__)
print("cuda_available:", torch.cuda.is_available())
if torch.cuda.is_available():
x = torch.rand(1, 128, 3, device="cuda")
y, idx = sample_farthest_points(x, K=16)
torch.cuda.synchronize()
print("pytorch3d cuda op ok:", y.shape, idx.shape)
PY
```
看到 `pytorch3d cuda op ok` 就说明 PyTorch3D 可以正常使用。
## 常见问题
如果提示 `No matching distribution found for pytorch3d`,不要直接 `pip install pytorch3d`。PyTorch3D 不是普通纯 Python 包,需要和 Python、PyTorch、CUDA 版本匹配。
如果提示 CUDA 版本不一致,先检查:
```bash
python - <<'PY'
import torch
print(torch.__version__)
print(torch.version.cuda)
PY
```
ACT 当前匹配的是 `torch==2.2.2+cu118`。如果你的环境是 `cu121`、`cu124` 或其他版本,这个 wheel 不一定适用。
如果是在 H20 服务器或同类型 GPU 上使用,推荐保持 ACT 环境和这里写的一致。
|