Hunyuan3D-2 Docker deployment — mini-turbo variant, low VRAM mode, PBR textures
This commit is contained in:
commit
5d34fa1ca6
36
README.md
Normal file
36
README.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Hunyuan3D-2 + Sunnie Animation Pipeline
|
||||||
|
|
||||||
|
Self-hosted Hunyuan3D-2 (mini-turbo variant) for generating a 3D Sunnie
|
||||||
|
mesh from a reference image, then rigging and animating in Blender via
|
||||||
|
Mixamo.
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the model repo
|
||||||
|
git clone https://github.com/Tencent-Hunyuan/Hunyuan3D-2.git
|
||||||
|
|
||||||
|
# Build and run
|
||||||
|
cd docker
|
||||||
|
docker compose build
|
||||||
|
docker compose up
|
||||||
|
|
||||||
|
# Gradio UI at http://localhost:8080
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
hunyuan3d-sunnie/
|
||||||
|
Hunyuan3D-2/ # cloned repo (git submodule or manual clone)
|
||||||
|
docker/
|
||||||
|
Dockerfile # custom build with CUDA 12.4
|
||||||
|
compose.yml # GPU-enabled compose with model volume
|
||||||
|
outputs/ # generated meshes land here
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- First run downloads model weights (~several GB) to the named volume
|
||||||
|
- Uses mini-turbo variant with --low_vram_mode for RTX 3080 (10GB VRAM)
|
||||||
|
- Outputs .glb with PBR textures for Blender import
|
||||||
52
docker/Dockerfile
Normal file
52
docker/Dockerfile
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# Hunyuan3D-2 — image to 3D mesh with PBR textures
|
||||||
|
# Community Dockerfile based on repo issues #125, #122
|
||||||
|
# Target: RTX 3080 (10GB VRAM) with mini-turbo variant
|
||||||
|
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04
|
||||||
|
|
||||||
|
LABEL name="hunyuan3d-2" maintainer="herby"
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# System dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git wget curl vim \
|
||||||
|
build-essential cmake \
|
||||||
|
python3 python3-pip python3-dev \
|
||||||
|
libgl1-mesa-glx libglib2.0-0 libsm6 libxrender1 libxext6 \
|
||||||
|
libegl1-mesa-dev libgles2-mesa-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Set python3 as default
|
||||||
|
RUN ln -sf /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
# Copy repo contents
|
||||||
|
COPY . /workspace/Hunyuan3D-2
|
||||||
|
WORKDIR /workspace/Hunyuan3D-2
|
||||||
|
|
||||||
|
# Install PyTorch with CUDA 12.4 support
|
||||||
|
RUN pip install --no-cache-dir \
|
||||||
|
torch torchvision torchaudio \
|
||||||
|
--index-url https://download.pytorch.org/whl/cu124
|
||||||
|
|
||||||
|
# Install project requirements
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Install additional deps that may be missing from upstream requirements
|
||||||
|
RUN pip install --no-cache-dir \
|
||||||
|
gradio \
|
||||||
|
onnxruntime \
|
||||||
|
flash-attn --no-build-isolation || true
|
||||||
|
|
||||||
|
# Install custom ops if available
|
||||||
|
RUN cd /workspace/Hunyuan3D-2 && \
|
||||||
|
pip install -e . || true
|
||||||
|
|
||||||
|
# Model cache directory
|
||||||
|
VOLUME /root/.cache/hy3dgen
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# Default command — overridden by compose.yml command
|
||||||
|
CMD ["python3", "gradio_app.py", "--host", "0.0.0.0", "--port", "8080"]
|
||||||
32
docker/compose.yml
Normal file
32
docker/compose.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
services:
|
||||||
|
hunyuan3d:
|
||||||
|
build:
|
||||||
|
context: ../Hunyuan3D-2
|
||||||
|
dockerfile: ../docker/Dockerfile
|
||||||
|
image: hunyuan3d-2:local
|
||||||
|
container_name: hunyuan3d
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
volumes:
|
||||||
|
- hunyuan3d-models:/root/.cache/hy3dgen
|
||||||
|
- ./outputs:/workspace/outputs
|
||||||
|
command: >
|
||||||
|
python3 gradio_app.py
|
||||||
|
--model_path tencent/Hunyuan3D-2mini
|
||||||
|
--subfolder hunyuan3d-dit-v2-mini-turbo
|
||||||
|
--texgen_model_path tencent/Hunyuan3D-2
|
||||||
|
--low_vram_mode
|
||||||
|
--enable_flashvdm
|
||||||
|
--host 0.0.0.0
|
||||||
|
--port 8080
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- driver: nvidia
|
||||||
|
count: all
|
||||||
|
capabilities: [gpu]
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
hunyuan3d-models:
|
||||||
Loading…
Reference in New Issue
Block a user