-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
72 lines (58 loc) · 2.2 KB
/
Dockerfile
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
66
67
68
69
70
71
72
FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-devel
LABEL org.opencontainers.image.source=https://github.com/manascb1344/zonos-api
LABEL org.opencontainers.image.description="Zonos API with GPU support"
LABEL org.opencontainers.image.licenses=MIT
# Set Zonos working directory
WORKDIR /app/zonos
# System packages
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ffmpeg \
libsndfile1 \
git \
espeak-ng \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install uv package manager
RUN --mount=type=cache,target=/root/.cache/pip \
pip3 install --no-cache-dir uv
# Clone Zonos directly into working directory
RUN git clone --depth 1 https://github.com/Zyphra/Zonos.git . \
&& git submodule update --init --recursive
# Copy dependency specs and application code
COPY requirements.txt pyproject.toml ./
COPY app/ app/
# Install basic Python dependencies first
RUN --mount=type=cache,target=/root/.cache/pip \
uv pip install --system -r requirements.txt -e .[compile]
# Install Flash Attention with specific compiler flags
ENV TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6+PTX"
ENV FLASH_ATTENTION_FORCE_BUILD=1
RUN --mount=type=cache,target=/root/.cache/pip \
uv pip install --system --no-build-isolation \
git+https://github.com/Dao-AILab/[email protected]
# Install remaining ML dependencies
RUN --mount=type=cache,target=/root/.cache/pip \
uv pip install --system --no-build-isolation \
mamba-ssm==2.2.4 \
causal-conv1d==1.5.0.post8
RUN --mount=type=cache,target=/root/.cache/pip \
uv pip install --system \
kanjize>=1.5.0 \
inflect>=7.5.0 \
&& rm -rf /root/.cache/pip/*
RUN --mount=type=cache,target=/root/.cache/pip \
uv pip install --system \
phonemizer>=3.3.0 \
sudachidict-full>=20241021 \
sudachipy>=0.6.10 \
&& rm -rf /root/.cache/pip/*
# Copy application code last
COPY app/ app/
# Environment variables
ENV PYTHONPATH=/app:/app/zonos \
USE_GPU=true \
PYTHONUNBUFFERED=1
# Run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]