File size: 1,561 Bytes
e99b3c1
d47df1b
 
 
 
 
 
57fa6f9
d47df1b
 
 
 
 
 
 
 
 
40328c3
d47df1b
 
 
e99b3c1
40328c3
 
2c40a1b
e99b3c1
 
61027c5
d47df1b
 
2c40a1b
e99b3c1
b1025e1
1b2c013
 
b1025e1
1b2c013
b1025e1
e99b3c1
2c40a1b
40328c3
61027c5
e99b3c1
 
d47df1b
 
 
 
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
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker

FROM nvidia/cuda:12.4.0-runtime-ubuntu22.04

RUN apt-get update && apt-get install -y \
    python3.10 python3.10-dev python3-pip \
    ffmpeg libsm6 libxext6 libgl1 \
    git libsndfile1 \
    && rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
RUN python -m pip install --upgrade pip

RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
ENV HF_HOME=/home/user/.cache/huggingface
ENV PYTHONUNBUFFERED=1

WORKDIR /app

# Clone official Wan2.2
RUN git clone https://github.com/Wan-Video/Wan2.2.git /app/Wan2.2

# Patch script
COPY --chown=user ./patch_wan_init.py /tmp/patch_wan_init.py

# PyTorch
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

# All deps (flash_attn may fail, that's ok)
RUN cd /app/Wan2.2 && (pip install --no-cache-dir -r requirements.txt 2>/dev/null; exit 0)
RUN pip install --no-cache-dir \
    diffusers opencv-python easydict decord einops ftfy "numpy>=1.23.5,<2" \
    transformers accelerate tokenizers peft \
    tqdm "imageio[ffmpeg]" imageio-ffmpeg sentencepiece \
    protobuf soundfile librosa dashscope

# Apply patches
RUN python3 /tmp/patch_wan_init.py

# Copy app
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=user ./app.py app.py
COPY --chown=user ./README.md README.md

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]