File size: 1,078 Bytes
06e4a45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04

ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
    python3.11 \
    python3.11-venv \
    python3-pip \
    git \
    && rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1

WORKDIR /app

# Upgrade pip to fix resolver bugs
RUN pip install --upgrade pip

# Install stable packages FIRST (these should never fail)
RUN pip install --no-cache-dir torch pillow sentencepiece protobuf fastapi uvicorn

# Install HuggingFace packages from git (might be slow/flaky)
RUN pip install --no-cache-dir git+https://github.com/huggingface/peft.git
RUN pip install --no-cache-dir git+https://github.com/huggingface/transformers.git
RUN pip install --no-cache-dir git+https://github.com/huggingface/accelerate.git
RUN pip install --no-cache-dir git+https://github.com/huggingface/diffusers.git

COPY app.py .
COPY handler.py .

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