File size: 2,715 Bytes
febacca
 
e6066e8
febacca
e6066e8
febacca
 
 
 
 
 
e6066e8
febacca
e6066e8
 
 
 
 
febacca
 
 
 
e6066e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
febacca
 
 
 
 
 
 
 
 
 
 
 
 
 
e6066e8
febacca
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# =============================================================================
# HF Spaces Docker image for daVinci-MagiHuman
# Hardware: A100-80GB (recommended)
# =============================================================================
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860

# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3.12 python3.12-dev python3.12-venv python3-pip \
    git ffmpeg libsndfile1 ninja-build && \
    rm -rf /var/lib/apt/lists/* && \
    ln -sf /usr/bin/python3.12 /usr/bin/python && \
    ln -sf /usr/bin/python3.12 /usr/bin/python3

WORKDIR /app

# ---------------------------------------------------------------------------
# PyTorch (must be installed first — MagiCompiler build depends on it)
# ---------------------------------------------------------------------------
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir torch torchvision torchaudio \
    --index-url https://download.pytorch.org/whl/cu124

# ---------------------------------------------------------------------------
# Local packages: MagiCompiler + stable-audio whl
# ---------------------------------------------------------------------------
COPY pkgs/ pkgs/
RUN pip install -e ./pkgs/MagiCompiler \
    --no-build-isolation --config-settings editable_mode=compat && \
    pip install --no-cache-dir pkgs/magife_stable_audio_open-1.0.0+mav.1-py3-none-any.whl

# ---------------------------------------------------------------------------
# Flash Attention (pre-built wheel for CUDA 12.4 + PyTorch 2.9)
# ---------------------------------------------------------------------------
RUN pip install --no-cache-dir flash-attn --no-build-isolation

# ---------------------------------------------------------------------------
# Project Python dependencies
# ---------------------------------------------------------------------------
COPY requirements.txt requirements-nodeps.txt ./
RUN pip install --no-cache-dir -r requirements.txt && \
    pip install --no-cache-dir --no-deps -r requirements-nodeps.txt && \
    pip install --no-cache-dir gradio huggingface_hub soundfile

# ---------------------------------------------------------------------------
# Project code
# ---------------------------------------------------------------------------
COPY inference/ inference/
COPY example/ example/
COPY app.py .

# Model weights are downloaded at runtime from HF Hub.
# Enable "Persistent storage" in Space settings so /data survives restarts.
ENV MODEL_ROOT=/data/models

EXPOSE 7860

CMD ["python", "app.py"]