文本/图片生成 3D 模型
配置
硬件
- i7-11700@2.50GHz
- 64GB RAM
- RTX 3060
- 12GB
软件
- Python 3.11.6
- CUDA 12.8: https://developer.nvidia.com/cuda-12-8-0-download-archive
- PyTorch 2.8.0+cu128: https://pytorch.org/get-started/locally
模型
没有在线 Interface,本地部署使用。每个模型使用独立的虚拟环境运行。
1 | python -m venv venv |
SF3D
- Code: Stability-AI/stable-fast-3d
- HuggingFace: stabilityai/stable-fast-3d
1 | # code |
依赖安装报错,把 requirement.txt 里的 texture_baker 和 uv_unwrapper 删除,手动安装
1 | # dependencies |
TripoSR
- Code: VAST-AI-Research/TripoSR
- HuggingFace: stabilityai/TripoSR
1 | # code |
Hunyuan3D
- Code: Tencent-Hunyuan/Hunyuan3D-2
- HuggingFace: tencent/Hunyuan3D-2
- Live Demo: https://huggingface.co/spaces/tencent/Hunyuan3D-2
1 | # code |
直接运行的话路由有问题,需修改 gradio_app.py
1 | app = gr.mount_gradio_app(app, demo, path="") # 删除 / |
1 | # image-to-3d |
启用 text-to-3d 需要加个 patch,在项目根目录新建 fix_lazy_loading.py
1 | import sys |
更新 gradio_app.py,导入 patch 文件
1 | import logger |
启用 text-to-3d 需要在运行时添加命令行参数 --enable_t23d
1 | # dependencies |
文本转模型相当慢,预计 40min 左右😂
TRELLIS
- Project: https://microsoft.github.io/TRELLIS
- Code: microsoft/TRELLIS
- Live Demo: https://huggingface.co/spaces/trellis-community/TRELLIS
Windows 上直接跑各种问题(Setting Up Trellis on Windows #3),后面直接找了个现成的 IgorAherne/trellis-stable-projectorz installer,暂不支持 text-to-3d
修改 code/gradio_main.py ,绑定到 0.0.0.0
1 | demo.launch(server_name="0.0.0.0") # 添加参数 |
解压后双击运行 run-gradio-fp16.bat,会自动创建虚拟环境。如果需要登录 huggingface 的话进入虚拟环境操作即可。
InstantMesh
- Code: TencentARC/InstantMesh
- HuggingFace: TencentARC/InstantMesh
1 | # code |
Stable-Zero123
- Project: https://zero123.cs.columbia.edu
- Code: cvlab-columbia/zero123
- HuggingFace: stabilityai/stable-zero123
需要通过 threestudio 使用
1 | # model |
添加环境变量
1 | D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64 |
直接跑预估 68h,trainer.max_steps
配置为 600,改成 5 只需要半小时
1 | python launch.py --config configs/stable-zero123.yaml --train --gpu 0 trainer.max_steps=5 data.image_path=./load/images/hamburger_rgba.png |
但是导出模型报错,暂未解决(太难用了)
1 | python launch.py --config "outputs/zero123-sai/[64, 128, 256]_hamburger_rgba.png@20250901-142614/configs/parsed.yaml" --export --gpu 0 resume="outputs/zero123-sai/[64, 128, 256]_hamburger_rgba.png@20250901-142614/ckpts/last.ckpt" system.exporter_type=mesh-exporter |
参阅
- 安装错误 #82
- fix: remove redundant “/” in Gradio mount path to prevent double slash in URL #296
- how to text-to-3D? #263
- tiny cuda install error #214
- failed import from igl #523
- ImportError: cannot import name ‘csrc’ from ‘nerfacc’ #156
- ModuleNotFoundError: No module named ‘triton’ while use wan video wrapper #6992
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Jckling's Blog!
评论