Fix Dockerfile CMD to point to app.py
Browse filesUpdated the Dockerfile to correctly use app.py instead of app_internvl2.py
- Dockerfile +78 -21
Dockerfile
CHANGED
@@ -1,34 +1,91 @@
|
|
1 |
-
FROM nvidia/cuda:
|
2 |
|
3 |
-
# Set
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Install system dependencies
|
7 |
-
RUN apt-get update && apt-get install -y \
|
8 |
-
|
9 |
-
python3-pip \
|
10 |
git \
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
&& rm -rf /var/lib/apt/lists/*
|
15 |
-
|
16 |
-
#
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
# Copy requirements file
|
20 |
COPY requirements.txt .
|
21 |
|
22 |
-
#
|
23 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
# Copy the
|
26 |
COPY . .
|
27 |
|
28 |
-
#
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
#
|
34 |
-
CMD ["python3", "app.py"]
|
|
|
1 |
+
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
|
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 MPLCONFIGDIR=/tmp/matplotlib
|
9 |
+
# Force PyTorch to use the NCCl backend
|
10 |
+
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
|
11 |
+
|
12 |
+
# Create necessary directories with proper permissions
|
13 |
+
RUN mkdir -p /app/.cache/huggingface/transformers && \
|
14 |
+
mkdir -p /tmp/matplotlib && \
|
15 |
+
mkdir -p /app/gradio_cached_examples && \
|
16 |
+
chmod -R 777 /app && \
|
17 |
+
chmod -R 777 /tmp/matplotlib
|
18 |
|
19 |
# Install system dependencies
|
20 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
21 |
+
build-essential \
|
|
|
22 |
git \
|
23 |
+
curl \
|
24 |
+
ca-certificates \
|
25 |
+
python3-pip \
|
26 |
+
python3-dev \
|
27 |
+
python3-setuptools \
|
28 |
&& rm -rf /var/lib/apt/lists/*
|
29 |
+
|
30 |
+
# Create a working directory
|
31 |
+
WORKDIR /app
|
32 |
+
|
33 |
+
# Add a script to check GPU status at startup
|
34 |
+
RUN echo '#!/bin/bash \n\
|
35 |
+
echo "Checking NVIDIA GPU status..." \n\
|
36 |
+
if ! command -v nvidia-smi &> /dev/null; then \n\
|
37 |
+
echo "WARNING: nvidia-smi command not found. NVIDIA driver might not be installed." \n\
|
38 |
+
else \n\
|
39 |
+
echo "NVIDIA driver found. Running nvidia-smi:" \n\
|
40 |
+
nvidia-smi \n\
|
41 |
+
fi \n\
|
42 |
+
echo "Environment variables for GPU:" \n\
|
43 |
+
echo "CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}" \n\
|
44 |
+
echo "NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}" \n\
|
45 |
+
exec "$@"' > /entrypoint.sh && \
|
46 |
+
chmod +x /entrypoint.sh
|
47 |
|
48 |
# Copy requirements file
|
49 |
COPY requirements.txt .
|
50 |
|
51 |
+
# Upgrade pip and install dependencies in specific order to avoid conflicts
|
52 |
+
RUN pip3 install --no-cache-dir --upgrade pip && \
|
53 |
+
# Install torch and torchvision first with CUDA support
|
54 |
+
pip3 install --no-cache-dir torch==2.0.1+cu118 torchvision==0.15.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 && \
|
55 |
+
# Install core dependencies
|
56 |
+
pip3 install --no-cache-dir numpy==1.24.3 scipy==1.11.3 requests==2.31.0 && \
|
57 |
+
# Install typing-extensions first to ensure proper version for other packages
|
58 |
+
pip3 install --no-cache-dir typing-extensions==4.10.0 && \
|
59 |
+
# Install huggingface dependencies
|
60 |
+
pip3 install --no-cache-dir transformers==4.37.2 safetensors==0.4.1 huggingface_hub==0.19.4 && \
|
61 |
+
# Install timm for vision models
|
62 |
+
pip3 install --no-cache-dir timm==0.9.11 && \
|
63 |
+
# Install nest-asyncio for handling nested event loops
|
64 |
+
pip3 install --no-cache-dir nest-asyncio==1.5.8 && \
|
65 |
+
# Install lmdeploy and its dependencies first
|
66 |
+
pip3 install --no-cache-dir "accelerate==0.30.0" && \
|
67 |
+
pip3 install --no-cache-dir "lmdeploy==0.5.3" && \
|
68 |
+
# Install other acceleration libraries
|
69 |
+
pip3 install --no-cache-dir bitsandbytes==0.41.3 && \
|
70 |
+
# Install gradio
|
71 |
+
pip3 install --no-cache-dir gradio==3.38.0 && \
|
72 |
+
# Install any remaining requirements
|
73 |
+
pip3 install --no-cache-dir packaging==23.2 pyyaml==6.0.1 tqdm==4.66.1 openai==1.6.1
|
74 |
|
75 |
+
# Copy the application files
|
76 |
COPY . .
|
77 |
|
78 |
+
# Make sure the runtime directories exist and have proper permissions
|
79 |
+
RUN mkdir -p gradio_cached_examples && \
|
80 |
+
chmod -R 777 gradio_cached_examples && \
|
81 |
+
mkdir -p .cache/huggingface/transformers && \
|
82 |
+
chmod -R 777 .cache
|
83 |
+
|
84 |
+
# Make port 7860 available for the app
|
85 |
+
EXPOSE 7860
|
86 |
+
|
87 |
+
# Use our entrypoint script to check GPU status before starting the app
|
88 |
+
ENTRYPOINT ["/entrypoint.sh"]
|
89 |
|
90 |
+
# Start the application - FIXED to point to the correct file
|
91 |
+
CMD ["python3", "app.py"]
|