File size: 2,477 Bytes
b703376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
65
# Woosh-DFlow text-to-audio BACKEND Space -- CPU build (free HF Space).
#
# For a dedicated-GPU Space, use Dockerfile.gpu instead (rename it to
# `Dockerfile`); the only difference is the torch wheel index (CUDA vs CPU).
#
# The install sequence mirrors Woosh's pyproject.toml, with two upstream quirks:
#   * hear21passt is installed with --no-deps (Woosh's uv config overrides its
#     requires-dist to empty; its runtime imports are covered by the deps below).
#   * The woosh package itself is installed with --no-deps (its deps are pinned
#     explicitly here) so pip never re-resolves the torch stack.
FROM python:3.12-slim-bookworm

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HF_HOME=/tmp/hf \
    PORT=7860

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential git curl unzip ffmpeg libsndfile1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# 1) Torch stack -- CPU wheels (this is the CPU image).
RUN pip install --upgrade pip \
 && pip install --index-url https://download.pytorch.org/whl/cpu \
        torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0

# 2) Woosh's declared runtime deps (from pyproject.toml), then Woosh itself.
RUN pip install \
        "einops>=0.8.1" \
        "hydra-core>=1.3.2" \
        "lightning>=2.5.6" \
        "timm>=1.0.22" \
        "torchdiffeq>=0.2.5" \
        "transformers>=4.57.2" \
        "pydantic>=2.12.4" \
        "omegaconf>=2.3.0" \
        "av>=16.1.0" \
        "requests" \
        "soundfile>=0.13.1" \
        "gradio>=6.9.0" \
 && pip install --no-deps "hear21passt==0.0.26" \
 && pip install --no-deps "git+https://github.com/SonyResearch/Woosh.git@main"

# 3) Model weights (CC-BY-NC, official v1.0.0 release), baked in for fast
#    restarts. Woosh-DFlow needs the DFlow LDM + the audio autoencoder (AE) +
#    the audio-CLAP text conditioner (TextConditionerA). Each zip extracts to
#    the correct checkpoints/<NAME> folder under /app.
RUN set -eux; cd /app; \
    for A in Woosh-DFlow Woosh-AE TextConditionerA; do \
      echo "Downloading $A.zip ..."; \
      curl -fL --retry 3 -o "$A.zip" \
        "https://github.com/SonyResearch/Woosh/releases/download/v1.0.0/$A.zip"; \
      unzip -q "$A.zip" -d /app; \
      rm -f "$A.zip"; \
    done; \
    ls -R /app/checkpoints | head -n 60

COPY app.py /app/app.py

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