TeddyUW commited on
Commit
a514f12
·
1 Parent(s): b434f1f
Files changed (1) hide show
  1. Dockerfile +21 -16
Dockerfile CHANGED
@@ -1,37 +1,42 @@
1
- # ---------- Detectron2 v0.6 wheel path (Torch 1.10 + cu113) ----------
2
- FROM pytorch/pytorch:1.10.2-cuda11.3-cudnn8-runtime
3
 
4
- ENV DEBIAN_FRONTEND=noninteractive PIP_NO_CACHE_DIR=1 PYTHONUNBUFFERED=1
 
 
5
 
6
- # Minimal system deps
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
- python3-dev build-essential git libgl1 ffmpeg && \
9
- rm -rf /var/lib/apt/lists/*
 
10
 
11
  WORKDIR /app
12
- RUN python3 -m pip install --upgrade pip
13
 
14
- # Detectron2 v0.6 prebuilt (matches torch1.10/cu113; see official table)
 
 
 
 
15
  RUN pip install --no-cache-dir -f \
16
  https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html \
17
  detectron2==0.6
18
 
19
- # Your deps (ensure these do NOT pin torch/torchvision/detectron2)
20
  COPY requirements.txt /app/requirements.txt
21
  RUN sed -i '/^torch/d;/^torchvision/d;/^detectron2/d' /app/requirements.txt && \
22
  pip install --no-cache-dir -r /app/requirements.txt
23
 
24
- # App
25
  COPY . /app
26
-
27
- # Sanity
28
- RUN python - <<'PY'
29
- import sys, torch, detectron2
30
  print("Python:", sys.version)
31
- print("Torch:", torch.__version__, "CUDA:", torch.version.cuda, "cuda_is_available:", torch.cuda.is_available())
 
32
  print("Detectron2:", detectron2.__version__)
33
  PY
34
 
35
  ENV GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860
36
  EXPOSE 7860
37
- CMD ["python", "app.py"]
 
1
+ # ---------- GPU build: CUDA 11.3 + Torch 1.10.2 + D2 0.6 ----------
2
+ FROM nvidia/cuda:11.3.1-cudnn8-runtime-ubuntu20.04
3
 
4
+ ENV DEBIAN_FRONTEND=noninteractive \
5
+ PIP_NO_CACHE_DIR=1 \
6
+ PYTHONUNBUFFERED=1
7
 
8
+ # Python 3.8 on 20.04 + build deps
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ python3 python3-pip python3-dev build-essential git libgl1 ffmpeg \
11
+ && rm -rf /var/lib/apt/lists/*
12
+ RUN python3 -m pip install --upgrade pip
13
 
14
  WORKDIR /app
 
15
 
16
+ # ----- PyTorch 1.10.2 + cu113 (matches D2 0.6 wheel matrix) -----
17
+ RUN pip install --no-cache-dir -f https://download.pytorch.org/whl/cu113/torch_stable.html \
18
+ torch==1.10.2+cu113 torchvision==0.11.3+cu113
19
+
20
+ # ----- Detectron2 0.6 prebuilt for torch1.10 + cu113 -----
21
  RUN pip install --no-cache-dir -f \
22
  https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html \
23
  detectron2==0.6
24
 
25
+ # ----- Your deps (ensure they DO NOT pin torch/torchvision/detectron2) -----
26
  COPY requirements.txt /app/requirements.txt
27
  RUN sed -i '/^torch/d;/^torchvision/d;/^detectron2/d' /app/requirements.txt && \
28
  pip install --no-cache-dir -r /app/requirements.txt
29
 
30
+ # ----- App code + quick sanity print -----
31
  COPY . /app
32
+ RUN python3 - <<'PY'
33
+ import sys, torch
 
 
34
  print("Python:", sys.version)
35
+ print("Torch:", torch.__version__, "CUDA:", torch.version.cuda, "cuda_available:", torch.cuda.is_available())
36
+ import detectron2
37
  print("Detectron2:", detectron2.__version__)
38
  PY
39
 
40
  ENV GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860
41
  EXPOSE 7860
42
+ CMD ["python3", "app.py"]