mknolan commited on
Commit
f7cf794
·
verified ·
1 Parent(s): dc05b26

Add Docker configuration for GPU diagnostics

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM huggingface/transformers-pytorch-gpu:latest
2
+
3
+ # Set basic environment variables
4
+ ENV PYTHONUNBUFFERED=1
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ curl \
9
+ git \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Set working directory
13
+ WORKDIR /app
14
+
15
+ # Install Python requirements
16
+ RUN pip install --no-cache-dir gradio==3.38.0 pillow numpy
17
+
18
+ # Copy diagnostic script
19
+ COPY gpu_test.py /app/
20
+
21
+ # Add a script to check GPU status at startup
22
+ RUN echo '#!/bin/bash \n\
23
+ echo "==== GPU DIAGNOSTICS STARTUP CHECKS ====" \n\
24
+ echo "Checking NVIDIA driver and CUDA:" \n\
25
+ nvidia-smi || echo "nvidia-smi failed - GPU may not be properly configured" \n\
26
+ echo "Current GPU-related environment variables:" \n\
27
+ echo "CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}" \n\
28
+ echo "NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}" \n\
29
+ echo "==== STARTING APPLICATION ====" \n\
30
+ exec "$@"' > /entrypoint.sh && \
31
+ chmod +x /entrypoint.sh
32
+
33
+ # Make port 7860 available for the app
34
+ EXPOSE 7860
35
+
36
+ # Use our entrypoint script to check GPU status before starting the app
37
+ ENTRYPOINT ["/entrypoint.sh"]
38
+
39
+ # Start the application
40
+ CMD ["python", "gpu_test.py"]