mknolan commited on
Commit
5bae866
·
verified ·
1 Parent(s): 981a54c

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
2
+
3
+ # Set environment variables
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+ ENV PYTHONUNBUFFERED=1
6
+ ENV HF_HOME=/app/.cache/huggingface
7
+ ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers
8
+ ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
9
+
10
+ # Create necessary directories with proper permissions
11
+ RUN mkdir -p /app/.cache/huggingface/transformers && \
12
+ chmod -R 777 /app
13
+
14
+ # Install system dependencies
15
+ RUN apt-get update && apt-get install -y --no-install-recommends \
16
+ build-essential \
17
+ git \
18
+ curl \
19
+ ca-certificates \
20
+ python3-pip \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Create a working directory
24
+ WORKDIR /app
25
+
26
+ # Copy requirements file
27
+ COPY requirements.txt ./requirements.txt
28
+
29
+ # Install dependencies
30
+ RUN pip3 install --no-cache-dir --upgrade pip && \
31
+ pip3 install --no-cache-dir -r requirements.txt
32
+
33
+ # Copy the diagnostic script
34
+ COPY debug_model_loading.py ./app.py
35
+
36
+ # Make port 7860 available
37
+ EXPOSE 7860
38
+
39
+ # Run the diagnostic
40
+ CMD ["python3", "app.py"]