-
Notifications
You must be signed in to change notification settings - Fork 351
Expand file tree
/
Copy pathDockerfile.rdna4
More file actions
56 lines (46 loc) · 2.26 KB
/
Copy pathDockerfile.rdna4
File metadata and controls
56 lines (46 loc) · 2.26 KB
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
FROM rocm/dev-ubuntu-22.04:latest
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV HF_HOME=/app/hf_cache
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libsndfile1 \
ffmpeg \
python3 \
python3-pip \
python3-dev \
python3-venv \
git \
rocm-ml-libraries \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /app
# Self-contained RDNA4 requirements (no dependency on other requirements files)
COPY requirements-rdna4-init.txt ./requirements-rdna4-init.txt
COPY requirements-rdna4.txt ./requirements-rdna4.txt
# Install order mirrors Dockerfile.rocm: ROCm torch first, then app deps,
# then chatterbox with --no-deps to prevent pip from replacing ROCm torch
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir -r requirements-rdna4-init.txt && \
python3 -m pip install --no-cache-dir -r requirements-rdna4.txt && \
python3 -m pip install --no-cache-dir --no-deps git+https://github.com/devnen/chatterbox-v2.git@master s3tokenizer==0.3.0 onnx==1.16.0 && \
python3 -m pip install --no-cache-dir "protobuf>=4.25.0"
# Patches for torch 2.9+ compatibility (required when using ROCm 7.2 wheels):
# s3tokenizer: numpy defaults to float64; cast to float32 to avoid
# float64 STFT → float64 mel → assertion failure
RUN sed -i \
's/wav = torch\.from_numpy(wav)$/wav = torch.from_numpy(wav).float()/' \
/usr/local/lib/python3.10/dist-packages/chatterbox/models/s3tokenizer/s3tokenizer.py && \
sed -i \
's/mel_spec = self\._mel_filters\.to(self\.device) @ magnitudes/mel_spec = self._mel_filters.to(self.device).to(magnitudes.dtype) @ magnitudes/' \
/usr/local/lib/python3.10/dist-packages/chatterbox/models/s3tokenizer/s3tokenizer.py
# voice_encoder: melspectrogram() returns float64 → LSTM requires float32
RUN sed -i \
's/utt_embeds = self\.inference(mels\.to(self\.device),/utt_embeds = self.inference(mels.to(self.device).float(),/' \
/usr/local/lib/python3.10/dist-packages/chatterbox/models/voice_encoder/voice_encoder.py
COPY . .
RUN mkdir -p model_cache reference_audio outputs voices logs hf_cache
EXPOSE 8004
CMD ["python3", "server.py"]