Rayugacodes commited on
Commit
9894974
·
verified ·
1 Parent(s): cfd9219

Fix: use CUDA base image for GPU support

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -4
Dockerfile CHANGED
@@ -1,8 +1,9 @@
1
- FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
- # HF Spaces runs as uid 1000 - set all cache dirs to writable locations
 
6
  ENV HF_HOME=/tmp/hf_cache
7
  ENV TRANSFORMERS_CACHE=/tmp/hf_cache
8
  ENV TORCH_HOME=/tmp/torch_cache
@@ -14,7 +15,7 @@ ENV USER=user
14
  RUN mkdir -p /tmp/hf_cache /tmp/torch_cache /tmp/cache /tmp/home && \
15
  chmod -R 777 /tmp/hf_cache /tmp/torch_cache /tmp/cache /tmp/home
16
 
17
- RUN pip install --no-cache-dir \
18
  torch \
19
  transformers \
20
  trl \
@@ -26,4 +27,5 @@ RUN pip install --no-cache-dir \
26
  COPY train_on_hf.py .
27
  RUN chmod -R 777 /app
28
 
29
- CMD ["sh", "-c", "python train_on_hf.py --hf-token $HF_TOKEN"]
 
 
1
+ FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04
2
 
3
  WORKDIR /app
4
 
5
+ RUN apt-get update && apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/*
6
+
7
  ENV HF_HOME=/tmp/hf_cache
8
  ENV TRANSFORMERS_CACHE=/tmp/hf_cache
9
  ENV TORCH_HOME=/tmp/torch_cache
 
15
  RUN mkdir -p /tmp/hf_cache /tmp/torch_cache /tmp/cache /tmp/home && \
16
  chmod -R 777 /tmp/hf_cache /tmp/torch_cache /tmp/cache /tmp/home
17
 
18
+ RUN pip3 install --no-cache-dir \
19
  torch \
20
  transformers \
21
  trl \
 
27
  COPY train_on_hf.py .
28
  RUN chmod -R 777 /app
29
 
30
+ EXPOSE 7860
31
+ CMD ["sh", "-c", "python3 train_on_hf.py --hf-token $HF_TOKEN"]