Seatalm's picture
Add ACT PyTorch3D wheel and install guide
ce896ee verified
|
Raw History Blame Contribute Delete
2.89 kB

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 文件:

pytorch3d-0.7.8-cp310-cp310-linux_x86_64.whl

校验值:

sha256: b051237f4b099f2f9644c656d7148722b8db0f6a7d02111f67e55b748ac68352

下载文件

在服务器上安装 Hugging Face CLI:

pip install -U huggingface_hub

下载 ACT requirements 和 PyTorch3D wheel:

hf download MetaAct/robotwin-act \
  --repo-type dataset \
  --include "Docker/requirements/robotwin-act-with-code_h20.requirements.txt" \
  --include "Docker/requirements/ACT/*" \
  --local-dir .

下载完成后,文件会在:

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 环境,例如:

conda activate RoboTwin

先安装 ACT 的普通依赖:

pip install -r Docker/requirements/robotwin-act-with-code_h20.requirements.txt

如果 requirements 里包含 pytorch3d 且安装失败,可以先跳过它,最后单独安装下面这个 wheel。

安装 PyTorch3D wheel:

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 相关包。

验证安装

运行:

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 版本不一致,先检查:

python - <<'PY'
import torch
print(torch.__version__)
print(torch.version.cuda)
PY

ACT 当前匹配的是 torch==2.2.2+cu118。如果你的环境是 cu121、cu124 或其他版本,这个 wheel 不一定适用。

如果是在 H20 服务器或同类型 GPU 上使用,推荐保持 ACT 环境和这里写的一致。