File size: 1,547 Bytes
1657b5e
9598146
 
 
 
 
1657b5e
9598146
 
 
 
 
c28cc54
 
9598146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4eec01b
 
1657b5e
4eec01b
 
 
 
 
1657b5e
c28cc54
272d144
1657b5e
 
 
 
272d144
 
 
 
9598146
 
 
 
 
 
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
FROM nvidia/cuda:12.9.0-devel-ubuntu24.04

# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Install Python and system dependencies
# devel image needed for flash_attn compilation (Granite NAR requires it)
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 \
    python3-pip \
    python3-dev \
    git \
    gcc \
    g++ \
    libsndfile1 \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# Set Python alias (Ubuntu 24.04 ships Python 3.12)
RUN ln -sf /usr/bin/python3 /usr/bin/python

# Allow pip to install packages system-wide in the container (PEP 668)
ENV PIP_BREAK_SYSTEM_PACKAGES=1

# Set working directory
WORKDIR /app

# Install PyTorch ecosystem (cu128 wheels for CUDA 12.8+/12.9 compat)
RUN pip install --no-cache-dir \
    torch==2.8.0 \
    torchaudio==2.8.0 \
    torchcodec==0.6.0 \
    --index-url https://download.pytorch.org/whl/cu128

# Install common requirements (torch already installed above, pip will skip it)
RUN pip install --no-cache-dir \
    transformers==4.57.6 \
    evaluate \
    datasets \
    librosa \
    jiwer \
    num2words \
    peft==0.13.1 \
    soundfile

# Install Flash Attention 2 (required by Granite NAR model)
RUN MAX_JOBS=8 pip install --no-cache-dir flash-attn==2.8.3 --no-build-isolation

# Force soundfile backend for datasets audio decoding
ENV HF_AUDIO_DECODER_BACKEND=soundfile

# Copy the full repository
COPY . /app

# Default entrypoint
ENTRYPOINT ["bash"]

EXPOSE 7860
CMD ["-c", "python3 -m http.server 7860"]