lyricolivia20 commited on
Commit
77fca9d
·
verified ·
1 Parent(s): d1fcfa7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -17
Dockerfile CHANGED
@@ -1,36 +1,33 @@
1
- FROM python:3.9-slim
 
2
 
 
3
  WORKDIR /app
4
  ENV TRANSFORMERS_CACHE=/app/cache \
5
- HF_HOME=/app/cache
 
6
 
7
- # 1. Install system dependencies (including scipy's required libraries)
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  git \
10
  gcc \
11
  g++ \
12
  make \
13
- libopenblas-dev \ # Required for scipy
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # 2. Create writable cache directory
17
  RUN mkdir -p /app/cache && chmod -R 777 /app/cache
18
 
19
- # 3. Install Python packages with COMPATIBLE versions
20
- RUN pip install --no-cache-dir \
21
- scipy \ # Explicitly install first
22
- torch==2.0.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 \
23
- transformers==4.34.0 \
24
- peft==0.5.0 \
25
- datasets==2.14.0 \
26
- accelerate==0.24.0 \
27
- bitsandbytes==0.41.0 \
28
- huggingface-hub==0.16.4
29
 
30
- # 4. Authenticate with Hugging Face
31
  ARG HF_TOKEN
32
  RUN python -c "from huggingface_hub import HfFolder; HfFolder.save_token('$HF_TOKEN')"
33
 
34
- COPY train.py .
 
35
 
 
36
  CMD ["python", "train.py"]
 
1
+ # Use a more specific Python version
2
+ FROM python:3.9.16-slim
3
 
4
+ # Set working directory and environment variables
5
  WORKDIR /app
6
  ENV TRANSFORMERS_CACHE=/app/cache \
7
+ HF_HOME=/app/cache \
8
+ PYTHONUNBUFFERED=1
9
 
10
+ # Install system dependencies
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
  git \
13
  gcc \
14
  g++ \
15
  make \
 
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Create writable cache directory
19
  RUN mkdir -p /app/cache && chmod -R 777 /app/cache
20
 
21
+ # Install Python packages using a requirements.txt file
22
+ COPY requirements.txt.
23
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
24
 
25
+ # Authenticate with Hugging Face
26
  ARG HF_TOKEN
27
  RUN python -c "from huggingface_hub import HfFolder; HfFolder.save_token('$HF_TOKEN')"
28
 
29
+ # Copy train.py file
30
+ COPY train.py.
31
 
32
+ # Set command to run train.py
33
  CMD ["python", "train.py"]