improve docker

This commit is contained in:
Terry Jia
2025-06-15 08:00:08 -04:00
parent 6f59a4ef12
commit 6416f05324
2 changed files with 47 additions and 5 deletions

View File

@@ -56,11 +56,6 @@ RUN pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url h
# Clone Hunyuan3D-2.1 repository
RUN git clone https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1.git
# Remove Chinese mirror sources and torchdiffeq from requirements.txt
RUN cd /workspace/Hunyuan3D-2.1 && \
sed -i '/--extra-index-url https:\/\/mirrors\.cloud\.tencent\.com\/pypi\/simple\//d' requirements.txt && \
sed -i '/--extra-index-url https:\/\/mirrors\.aliyun\.com\/pypi\/simple/d' requirements.txt
# Install Python dependencies from modified requirements.txt
RUN pip install -r Hunyuan3D-2.1/requirements.txt
@@ -79,6 +74,19 @@ RUN cd /workspace/Hunyuan3D-2.1/hy3dpaint/DifferentiableRenderer && \
RUN cd /workspace/Hunyuan3D-2.1 && \
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P ckpt
# Create ckpt folder in hy3dpaint and download RealESRGAN model
RUN cd /workspace/Hunyuan3D-2.1/hy3dpaint && \
mkdir -p ckpt && \
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P ckpt
# Modify textureGenPipeline.py to update config path
RUN cd /workspace/Hunyuan3D-2.1/hy3dpaint && \
sed -i 's/self\.multiview_cfg_path = "cfgs\/hunyuan-paint-pbr\.yaml"/self.multiview_cfg_path = "hy3dpaint\/cfgs\/hunyuan-paint-pbr.yaml"/' textureGenPipeline.py
# Modify multiview_utils.py to update custom_pipeline path
RUN cd /workspace/Hunyuan3D-2.1/hy3dpaint/utils && \
sed -i 's/custom_pipeline = config\.custom_pipeline/custom_pipeline = os.path.join(os.path.dirname(__file__),"..","hunyuanpaintpbr")/' multiview_utils.py
# Set working directory to the cloned repository
WORKDIR /workspace/Hunyuan3D-2.1

34
docker/README.md Normal file
View File

@@ -0,0 +1,34 @@
# Docker setup
This docker setup is tested on Windows 10.
make sure you are under this directory yourworkspace/Hunyuan3D-2.1/docker
Build docker image:
```
docker build -t hunyuan3d21:latest .
```
Run docker image at the first time:
```
docker run -it --name hy3d21 -p 7860:7860 --gpus all hunyuan3d21 python gradio_app.py --port 7860
```
After first time:
```
docker start hy3d21
docker exec -it hy3d21 python gradio_app.py --port 7860
```
Stop the container:
```
docker stop hy3d21
```
You can find the demo link showing in terminal, such as `http://0.0.0.0:7860`, then you cuold access `http://127.0.0.1:7860` from your host machine.
Some notes:
1. the total built time might take more than one hour.
2. the total size of the built image will be more than 70GB.