-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathDockerfile.AMD
More file actions
68 lines (53 loc) · 2.42 KB
/
Dockerfile.AMD
File metadata and controls
68 lines (53 loc) · 2.42 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
57
58
59
60
61
62
63
64
65
66
67
68
FROM ghcr.io/jordimas/ctranslate2:latest-ubuntu22.04-rocm7.2
COPY entrypoint.sh /
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg python3 python3-pip curl gosu tzdata libomp5 libdw1 \
&& ln -s /usr/lib/x86_64-linux-gnu/libomp.so.5 /usr/lib/x86_64-linux-gnu/libomp.so \
&& ldconfig \
&& rm -rf /var/lib/apt/lists/*
# Install torch with ROCm 7.2 nightly wheels to match the ctranslate2 ROCm 7.2 base image.
# The previous rocm6.2 wheels caused an HSA ABI mismatch (SIGSEGV on container startup).
# Nightly is required as stable PyTorch wheels only go up to rocm6.2 currently.
RUN python3 -m pip install -U --no-cache-dir --pre \
torch torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm7.2
RUN python3 -m pip install -U --no-cache-dir \
numpy \
fastapi \
requests \
uvicorn \
python-multipart \
ffmpeg-python \
watchdog \
tqdm \
more-itertools \
transformers \
tokenizers \
huggingface-hub \
av \
scipy
RUN python3 -m pip install -U --no-cache-dir --no-deps faster-whisper
RUN python3 -m pip install -U --no-cache-dir --no-deps stable-ts-whisperless
WORKDIR /subgen
COPY launcher.py subgen.py language_code.py /subgen/
RUN mkdir -p /cache && chmod 777 /cache
# -------------------------------------------------------------------
# --- ENVIRONMENT VARIABLES (Baked in for automatic execution) ---
# -------------------------------------------------------------------
# 1. Standard caches
ENV XDG_CACHE_HOME=/cache \
HF_HOME=/cache/huggingface \
MPLCONFIGDIR=/cache/matplotlib
# 2. Fix the Library Paths (Points to CTranslate2 and ROCm 7.2)
ENV LD_LIBRARY_PATH="/opt/ctranslate2/lib:/opt/rocm-7.2.0/lib:/opt/rocm-7.2.0/lib64:${LD_LIBRARY_PATH}"
# 3. Preload the ROCm 7.2 HSA Runtime to ensure both torch and ctranslate2 share
# the same HSA runtime (both are now built against ROCm 7.2).
ENV LD_PRELOAD="/opt/rocm-7.2.0/lib/libhsa-runtime64.so.1"
# 4. Fix GPU memory page faults (Page not present) during ctranslate2 inference on
# RDNA3 GPUs (gfx1100/gfx1101). The default allocator causes invalid GPU memory
# mappings; cub_caching uses a stable allocation path. See OpenNMT/CTranslate2#2021.
ENV CT2_CUDA_ALLOCATOR="cub_caching"
# -------------------------------------------------------------------
ENTRYPOINT ["/entrypoint.sh"]
CMD ["python3", "-u", "launcher.py"]