ShalomKing commited on
Commit
206a9e2
·
verified ·
1 Parent(s): c16ed8b

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +68 -0
Dockerfile ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.1.0-devel-ubuntu22.04
2
+
3
+ # Set environment variables
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+ ENV PYTHONUNBUFFERED=1
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ python3.10 \
10
+ python3.10-dev \
11
+ python3-pip \
12
+ git \
13
+ git-lfs \
14
+ ffmpeg \
15
+ build-essential \
16
+ libsndfile1 \
17
+ ninja-build \
18
+ && rm -rf /var/lib/apt/lists/* \
19
+ && git lfs install
20
+
21
+ # Set Python 3.10 as default
22
+ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
23
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
24
+
25
+ # Upgrade pip
26
+ RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel
27
+
28
+ # Install PyTorch FIRST (required for flash-attn compilation)
29
+ RUN pip install --no-cache-dir \
30
+ torch==2.4.1 \
31
+ torchvision==0.19.1 \
32
+ torchaudio==2.4.1
33
+
34
+ # Install flash-attn separately with proper flags
35
+ RUN pip install --no-cache-dir flash-attn==2.7.4.post1 --no-build-isolation
36
+
37
+ # Set working directory
38
+ WORKDIR /app
39
+
40
+ # Copy requirements (without torch and flash-attn since we installed them)
41
+ COPY requirements.txt /tmp/requirements-base.txt
42
+
43
+ # Install remaining requirements
44
+ RUN grep -v "^torch==" /tmp/requirements-base.txt | \
45
+ grep -v "^torchvision==" | \
46
+ grep -v "^torchaudio==" | \
47
+ grep -v "^flash-attn==" | \
48
+ pip install --no-cache-dir -r /dev/stdin
49
+
50
+ # Copy application files
51
+ COPY . .
52
+
53
+ # Create user and set permissions
54
+ RUN useradd -m -u 1000 user && \
55
+ chown -R user:user /app
56
+
57
+ USER user
58
+
59
+ # Set environment for HuggingFace
60
+ ENV HOME=/home/user \
61
+ PATH=/home/user/.local/bin:$PATH \
62
+ PYTHONPATH=/app
63
+
64
+ # Expose port for Gradio
65
+ EXPOSE 7860
66
+
67
+ # Run the application
68
+ CMD ["python", "app.py"]