PhysicalWM / OVOW /environment /README.md
Ravenveil's picture
backup 06_ovow_code 2026-11-08 10:30:30 (part 8)
ef0b17d verified
|
Raw History Blame Contribute Delete
5.04 kB

环境重建

推荐直接用一键脚本:bash environment/create_envs.sh(可 [opg|sam3|motion] 单建; 结束时打印该填进 .env 的解释器路径)。本文档是它背后的版本表与逐条手动命令—— 脚本哪一步失败,就照下面手动补装哪一步。

OVOW 用 3 个互不兼容的 conda 环境(torch/CUDA 强耦合,不能纯 pip 复现,需对齐 CUDA)。

env python torch 用途 依赖清单
ovow-opg 3.11 2.4.1+cu121 主重建 / scale / 位姿 requirements-opg.txt
ovow-sam3 3.12 2.7.0+cu118 SAM3 分割 requirements-sam3.txt
ovow-motion 3.11 2.4.1+cu124 Motion324 + Hunyuan deform requirements-motion.txt

**三个环境的 torch 各绑一个 CUDA 版本(cu121 / cu118 / cu124)**——这是 pip wheel 自带的 CUDA runtime,互不冲突,也不要求系统装三套 CUDA Toolkit。系统侧只需: ① NVIDIA 驱动 ≥550(能跑 cu124 wheel 即可全兼容);② 一套 CUDA Toolkit(建议 12.1+, 含 nvcc)用于现场编译扩展——opg 的一批(见下表)+ motion 的 custom_rasterizer; sam3 无需编译,纯 pip 即装。 requirements-sam3.txt / requirements-motion.txt 已内置对应的 --extra-index-url(PyTorch 官方 wheel 源),直接 pip install -r 即可。

重建(以 opg 为例,顺序重要):

conda create -n ovow-opg python=3.11 -y && conda activate ovow-opg
# 1) 先按你的 CUDA 装 torch(示例 cu121)
pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cu121
# 2) PyPI + git 源依赖
pip install -r environment/requirements-opg.txt
# 3) 需现场编译的 CUDA 扩展(按目标 CUDA 编译,务必对齐 torch/CUDA)
bash environment/build_cuda_exts.sh        # 见下,封装了下面所有 clone+build
# 4) 引擎自带子包(editable,从仓库内 engine/ 安装)
for p in Amodal3R fpose fpose/fpose/bundlesdf/mycuda SpaTrackerV2 trellis DA3; do
  pip install -e engine/oneposeviagen/$p
done

CUDA 扩展来源(已补全,2026-06-15)

扩展 用途 来源 / 安装
pytorch3d 3D 算子 pip install --no-build-isolation git+https://github.com/facebookresearch/pytorch3d.git
flash-attn 注意力 pip install flash-attn --no-build-isolation(或用官方预编译 whl 对齐 cu121/torch2.4)
nvdiffrast 可微渲染 pip install git+https://github.com/NVlabs/nvdiffrast.git
diffoctreerast TRELLIS 渲染 pip install git+https://github.com/JeffreyXiang/diffoctreerast.git
diff-gaussian-rasterization 3DGS clone autonomousvision/mip-splatting 后装其 submodules/diff-gaussian-rasterization/
simple-knn 3DGS 同上 mip-splatting 的 submodules/simple-knn/
CuMesh(原缺源) TRELLIS2 网格/UV pip install --no-build-isolation git+https://github.com/JeffreyXiang/CuMesh.git(需 torch≥2.4 + CUDA≥12.4)
nvdiffrec-renderutils(原缺源) TRELLIS2 渲染(模块名 nvdiffrec_render) git clone -b renderutils https://github.com/JeffreyXiang/nvdiffrec.git /tmp/nvdiffrec && pip install /tmp/nvdiffrec --no-build-isolation
o-voxel / flexgemm TRELLIS2 o-voxel 源在仓库内 engine/oneposeviagen/TRELLIS2/o-voxel;flexgemm 见 microsoft/TRELLIS.2 的 setup.sh --flexgemm
utils3d 工具 pip install git+https://github.com/EasternJournalist/utils3d.git
custom_rasterizer Hunyuan 贴图(motion 环境) 源在仓库内 third_party/Motion324/scripts/hy3dgen/texgen/custom_rasterizer,pip install -e 之
FoundationPose 扩展 位姿 cd engine/oneposeviagen/fpose && bash build_all_conda.sh

重要:CuMesh / nvdiffrec / o-voxel / flexgemm 仅 TRELLIS2 backbone 用到。 而 OVOW 入口(scripts/run_video.sh / run_fullpipe_batch.sh)的默认 backbone 是 uplegacy (= legacy/Hi3DGen 生成后端 + 升级版位姿链路:romav2 匹配 + 零迭代 scale + 全部模型进程内常驻; 见 configs/paths.sh 的 OPG_MATCHER=romav2 / OPG_SCALE_REFINE_ITERS=0 / OPG_ROMAV2_INPROC=1 / OPG_FP_RESIDENT=1)。 uplegacy 的生成后端会折叠成 legacy/Hi3DGen,不走 TRELLIS2——所以默认复现不需要 CuMesh/nvdiffrec, 上游 OnePoseviaGen 的 setup.sh 也只装前面的 CORE。仅当显式 --recon-backbone trellis2 时才需要: bash environment/build_cuda_exts.sh --trellis2。权威脚本见 microsoft/TRELLIS.2 setup.sh。

OVOW 引擎自带 engine/setup.sh(= 上游官方安装流程)是权威参照;build_cuda_exts.sh 即对齐它。

注意:

  • 环境与 CUDA 强耦合,不能纯 pip 一键复现;step 3/4 需现场编译,务必对齐 CUDA/torch 版本。
  • requirements-*.txt 已剔除 dev 机器本地路径,只留 PyPI + git 源;原始 pip freeze 见 *.freeze.bak(仅版本参考)。
  • 引擎自带 setup.sh 也编码了上述步骤,可对照参考。
  • flux / hdr 环境为可选步骤,未纳入核心复现。