InstantMesh Docker deployment — CUDA 12.1, onnxruntime fix, GPU compose
This commit is contained in:
commit
3a8765adce
75
docker/Dockerfile
Normal file
75
docker/Dockerfile
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# InstantMesh — single-image to 3D mesh generation
|
||||||
|
# Based on upstream TencentARC/InstantMesh docker config
|
||||||
|
# Patched: onnxruntime added, duplicate conda create removed, CUDA aligned
|
||||||
|
FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04
|
||||||
|
|
||||||
|
LABEL name="instantmesh" maintainer="instantmesh"
|
||||||
|
|
||||||
|
VOLUME /workspace/models
|
||||||
|
|
||||||
|
RUN mkdir -p /workspace/instantmesh
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
# Timezone
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y tzdata && \
|
||||||
|
ln -fs /usr/share/zoneinfo/America/Chicago /etc/localtime && \
|
||||||
|
dpkg-reconfigure --frontend noninteractive tzdata
|
||||||
|
|
||||||
|
# System dependencies
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y build-essential git wget vim libegl1-mesa-dev libglib2.0-0 unzip
|
||||||
|
|
||||||
|
# Miniconda
|
||||||
|
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
|
||||||
|
chmod +x Miniconda3-latest-Linux-x86_64.sh && \
|
||||||
|
./Miniconda3-latest-Linux-x86_64.sh -b -p /workspace/miniconda3 && \
|
||||||
|
rm Miniconda3-latest-Linux-x86_64.sh
|
||||||
|
|
||||||
|
ENV PATH="/workspace/miniconda3/bin:${PATH}"
|
||||||
|
|
||||||
|
RUN conda init bash
|
||||||
|
|
||||||
|
# Auto-accept conda TOS for non-interactive builds
|
||||||
|
ENV CONDA_PLUGINS_AUTO_ACCEPT_TOS=true
|
||||||
|
|
||||||
|
# Create conda environment
|
||||||
|
RUN conda create -n instantmesh python=3.10 && \
|
||||||
|
echo "source activate instantmesh" > ~/.bashrc
|
||||||
|
ENV PATH /workspace/miniconda3/envs/instantmesh/bin:$PATH
|
||||||
|
|
||||||
|
RUN conda install Ninja
|
||||||
|
RUN conda install cuda -c nvidia/label/cuda-12.1.0 -y
|
||||||
|
|
||||||
|
# PyTorch + friends (matched to CUDA 12.1)
|
||||||
|
RUN pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
|
||||||
|
RUN pip install xformers==0.0.22.post7
|
||||||
|
RUN pip install triton
|
||||||
|
|
||||||
|
WORKDIR /workspace/instantmesh
|
||||||
|
|
||||||
|
# Python dependencies
|
||||||
|
ADD ./requirements.txt /workspace/instantmesh/requirements.txt
|
||||||
|
|
||||||
|
# 1. Install Ninja (makes CUDA compilation faster and more reliable)
|
||||||
|
RUN pip install ninja
|
||||||
|
|
||||||
|
# 2. Install most requirements, but skip the problematic ones for a second
|
||||||
|
# We use a trick to ignore the nvdiffrast line if it's in the file
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt || true
|
||||||
|
|
||||||
|
# 3. Manually install nvdiffrast with the magic flag
|
||||||
|
RUN pip install git+https://github.com/NVlabs/nvdiffrast.git --no-build-isolation
|
||||||
|
|
||||||
|
|
||||||
|
#RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Fix upstream issue #175 — onnxruntime not in original requirements
|
||||||
|
RUN pip install onnxruntime
|
||||||
|
|
||||||
|
COPY . /workspace/instantmesh
|
||||||
|
|
||||||
|
EXPOSE 43839
|
||||||
|
|
||||||
|
CMD ["python", "app.py"]
|
||||||
22
docker/compose.yml
Normal file
22
docker/compose.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
services:
|
||||||
|
instantmesh:
|
||||||
|
build:
|
||||||
|
context: ../InstantMesh
|
||||||
|
dockerfile: ../docker/Dockerfile
|
||||||
|
image: instantmesh:local
|
||||||
|
container_name: instantmesh
|
||||||
|
ports:
|
||||||
|
- "43839:43839"
|
||||||
|
volumes:
|
||||||
|
- instantmesh-models:/workspace/models
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- driver: nvidia
|
||||||
|
count: all
|
||||||
|
capabilities: [gpu]
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
instantmesh-models:
|
||||||
19
docker/requirements.txt
Normal file
19
docker/requirements.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
pytorch-lightning==2.1.2
|
||||||
|
gradio==3.41.2
|
||||||
|
huggingface-hub
|
||||||
|
einops
|
||||||
|
omegaconf
|
||||||
|
torchmetrics
|
||||||
|
webdataset
|
||||||
|
accelerate
|
||||||
|
tensorboard
|
||||||
|
PyMCubes
|
||||||
|
trimesh
|
||||||
|
rembg
|
||||||
|
transformers==4.34.1
|
||||||
|
diffusers==0.20.2
|
||||||
|
bitsandbytes
|
||||||
|
imageio[ffmpeg]
|
||||||
|
xatlas
|
||||||
|
plyfile
|
||||||
|
git+https://github.com/NVlabs/nvdiffrast/
|
||||||
6
main.py
Normal file
6
main.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
def main():
|
||||||
|
print("Hello from instamesh-docker!")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
7
pyproject.toml
Normal file
7
pyproject.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[project]
|
||||||
|
name = "instamesh-docker"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Add your description here"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.12"
|
||||||
|
dependencies = []
|
||||||
Loading…
Reference in New Issue
Block a user