Spaces:
Runtime error
Runtime error
docker
Browse files12345678910112 unmodified lines14151617181920212223242526272829303132333435363738394041424344454647484950# ---- Base: CUDA 11.8 runtime (no compiler needed since we use wheels) ----FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04ENV PYTHONUNBUFFERED=1 \PIP_NO_CACHE_DIR=1 \DEBIAN_FRONTEND=noninteractive# Minimal system deps (libgl1, ffmpeg often needed for cv2/visualization)RUN apt-get update && apt-get install -y --no-install-recommends \python3 python3-pip python3-dev build-essential git \libgl1 ffmpeg \2 unmodified linesWORKDIR /appRUN python3 -m pip install --upgrade pip# ---- Install Torch/TV that match a Detectron2 0.6 prebuilt wheel (cu118) ----# NOTE: keep these exact versions to match the D2 wheel index below.RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cu118 \torch==2.1.2+cu118 torchvision==0.16.2+cu118# ---- Install Detectron2 0.6 from official prebuilt wheels (cu118 / torch2.1) ----RUN pip install --no-cache-dir -f \https://dl.fbaipublicfiles.com/detectron2/wheels/cu118/torch2.1/index.html \detectron2==0.6# ---- App dependencies (ensure requirements.txt does NOT reinstall torch/D2) ----COPY requirements.txt /app/requirements.txtRUN sed -i '/torch/d;/detectron2/d' /app/requirements.txt && \pip install --no-cache-dir -r /app/requirements.txt# ---- App code ----COPY . /app# Optional: log versions at build-time to verify the environmentRUN python3 - <<'PY'import torch, sysprint("Python:", sys.version)print("Torch:", torch.__version__, "CUDA:", torch.version.cuda, "CUDA avail:", torch.cuda.is_available())import detectron2print("Detectron2:", detectron2.__version__)PY# Gradio defaults for SpacesENV GRADIO_SERVER_NAME=0.0.0.0 \GRADIO_SERVER_PORT=7860EXPOSE 7860# Start your app (adjust if your entrypoint is different)CMD ["python3", "app.py"]12345678910112 unmodified lines1415161718192021222324252627282930313233343536373839404142434445# ---------- GPU build: CUDA 12.1 + Torch 2.4.1 + Detectron2 0.6 ----------FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04ENV DEBIAN_FRONTEND=noninteractive \PIP_NO_CACHE_DIR=1 \PYTHONUNBUFFERED=1# Minimal system depsRUN apt-get update && apt-get install -y --no-install-recommends \python3 python3-pip python3-dev build-essential git \libgl1 ffmpeg \2 unmodified linesWORKDIR /appRUN python3 -m pip install --upgrade pip# ---- Torch/TV matching D2 wheel (cu121 / torch 2.4) ----RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cu121 \torch==2.4.1+cu121 torchvision==0.19.1+cu121# ---- Detectron2 0.6 prebuilt wheel (matches cu121 + torch2.4) ----RUN pip install --no-cache-dir -f \https://dl.fbaipublicfiles.com/detectron2/wheels/cu121/torch2.4/index.html \detectron2==0.6# ---- Your deps (make sure requirements.txt DOES NOT list torch or detectron2) ----COPY requirements.txt /app/requirements.txtRUN sed -i '/^torch/d;/^torchvision/d;/^detectron2/d' /app/requirements.txt && \pip install --no-cache-dir -r /app/requirements.txt# ---- App code ----COPY . /app# Sanity printRUN python3 - <<'PY'import sys, torchprint("Python:", sys.version)print("Torch:", torch.__version__, "CUDA:", torch.version.cuda, "cuda_is_available:", torch.cuda.is_available())import detectron2print("Detectron2:", detectron2.__version__)PYENV GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860EXPOSE 7860CMD ["python3", "app.py"]
Dockerfile+16-21