Spaces:
Paused
Paused
File size: 2,856 Bytes
5c3ed8a fef0469 9ec7973 fef0469 9ec7973 060c2e0 9ec7973 1d5fce8 b774d26 060c2e0 32d9785 9ec7973 fef0469 c199fc6 fef0469 | 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 | # Hugging Face Docker Space: API and GPU worker only. The web/ frontend deploys separately.
# README.md declares sdk: docker and app_port: 7860.
FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 \
STORAGE_ROOT=/home/mod/data HF_HOME=/home/mod/data/huggingface \
APP_ENV=testing WORKER_CONCURRENCY=1
# fonts-dejavu-core is the caption font; sox is needed by qwen-tts.
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg git sox fonts-dejavu-core && rm -rf /var/lib/apt/lists/*
WORKDIR /opt/mod
COPY requirements.txt requirements-gpu.txt ./
RUN pip install -r requirements-gpu.txt && pip check
RUN useradd -u 1000 -m mod && mkdir -p /home/mod/data && chown mod:mod /home/mod/data
# Talking-head model. It has no importable API and pins an older torch, so it gets its own
# checkout and virtualenv; app/providers/talking.py runs it as a subprocess.
ARG INFINITETALK_COMMIT=50aa0a94184315407a991ae804d9b58d6d311ba8
RUN git clone https://github.com/MeiGen-AI/InfiniteTalk /opt/infinitetalk \
&& git -C /opt/infinitetalk checkout -q $INFINITETALK_COMMIT \
# Upstream targets Python 3.10; this unused import no longer exists in 3.11.
&& sed -i '/^from inspect import ArgSpec$/d' /opt/infinitetalk/wan/multitalk.py \
&& python -m venv /opt/infinitetalk/venv \
&& /opt/infinitetalk/venv/bin/pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 xformers==0.0.28 \
--index-url https://download.pytorch.org/whl/cu121 \
# Its requirements are unpinned and today's releases need a newer torch, so resolve
# everything as of the model's release date.
&& pip install uv==0.8.13 \
&& uv pip install --python /opt/infinitetalk/venv/bin/python --exclude-newer 2025-09-01 \
-r /opt/infinitetalk/requirements.txt librosa soundfile "misaki[en]" diffusers==0.34.0 transformers==4.52.4 distvae==0.0.0b5 kokoro \
# The model asserts flash-attention is present; this image has no compiler, so use the prebuilt wheel.
&& /opt/infinitetalk/venv/bin/pip install --no-deps \
"https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl" \
&& chown -R mod:mod /opt/infinitetalk
# BE: FastAPI routes, background GPU worker and model configuration.
COPY --chown=mod:mod app app
COPY --chown=mod:mod config config
USER mod
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:7860/health/ready', timeout=4)"
# One server process owns the configurable inference worker pool.
CMD ["uvicorn", "app.main:create_app", "--factory", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--no-access-log"]
|