diff --git a/.gitignore b/.gitignore index 340160b..aeb8d88 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ runs/* *.pt __pycache__/ __pycache__/* + +# Local dependency-verification artifact (CPU freeze); not for the repo +.verified-freeze-cpu.txt diff --git a/Dockerfile b/Dockerfile index 529f442..e3926d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,16 @@ # no-code-deeplearning-prod/Dockerfile -# Use NVIDIA's official CUDA base image -FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu22.04 +# NVIDIA CUDA base. Ubuntu 24.04 ships Python 3.12, which the pinned stack in +# requirements.txt requires (numpy 2.4 / pandas 3.0 need Python >= 3.11). +FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04 ENV DEBIAN_FRONTEND=noninteractive -# Install Python 3.10 and pip +# Python 3.12 + the OpenCV/rendering shared libs pulled in by opencv/albumentations. RUN apt-get update && \ apt-get install -y \ - python3.10 \ + python3.12 \ + python3.12-venv \ python3-pip \ libgl1 \ libglib2.0-0 \ @@ -18,16 +20,21 @@ RUN apt-get update && \ libfontconfig1 \ && rm -rf /var/lib/apt/lists/* -RUN ln -sf /usr/bin/python3.10 /usr/bin/python && \ - ln -sf /usr/bin/pip3 /usr/bin/pip +# Use an isolated virtualenv. On Ubuntu 24.04 the system Python is +# externally-managed (PEP 668), so installing into it needs a venv (or +# --break-system-packages); a venv is cleaner and keeps the image reproducible. +RUN python3.12 -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" WORKDIR /app # Copy requirements first for layer caching COPY requirements.txt . -# Install Python dependencies (with CUDA torch) -RUN pip install --no-cache-dir -r requirements.txt +# Install the pinned dependencies. On this CUDA base image, PyPI serves the +# CUDA build of the pinned torch version. +RUN pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir -r requirements.txt # Copy the entire DL service codebase -COPY . . \ No newline at end of file +COPY . . diff --git a/requirements.txt b/requirements.txt index 7f9995a..7b7ee79 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,40 +1,54 @@ +# Pinned to a verified-working stack. +# +# Every version below was confirmed by running the full train -> evaluate -> +# save -> inference cycle for all three tasks and both model families per task +# (image classification, object detection via DETR and YOLO, semantic +# segmentation via SegFormer and SMP U-Net) on Python 3.12 / CPU torch. +# +# Torch is pinned by version only (no +cpu local tag): on the CUDA base image in +# the Dockerfile, PyPI serves the matching CUDA build of the same version. +# +# To refresh: bump a pin, re-run the smoke tests for all tasks, then commit. + # --- Core ML/DL --- -torch -torchvision -torchaudio -accelerate +torch==2.13.0 +torchvision==0.28.0 +torchaudio==2.11.0 +accelerate==1.14.0 # --- Hugging Face --- -transformers -datasets -evaluate -huggingface_hub +transformers==5.13.1 +datasets==5.0.0 +evaluate==0.4.6 +huggingface_hub==1.23.0 # --- Task-Specific --- -albumentations -torchmetrics -timm -pycocotools -ultralytics -faster-coco-eval -segmentation-models-pytorch +albumentations==2.0.8 +torchmetrics==1.9.0 +timm==1.0.28 +pycocotools==2.0.11 +ultralytics==8.4.92 +faster-coco-eval==1.7.2 +segmentation-models-pytorch==0.5.0 -# --- API & UI --- -fastapi -uvicorn[standard] -python-multipart -gradio +# --- API --- +fastapi==0.139.0 +uvicorn[standard]==0.51.0 +python-multipart==0.0.32 # --- Utilities --- -numpy -pandas -scipy -Pillow -wandb -psutil -scikit-learn +numpy==2.4.4 +pandas==3.0.3 +scipy==1.18.0 +Pillow==12.2.0 +psutil==7.2.2 +scikit-learn==1.9.0 # --- Job Persistence & Queuing --- -sqlalchemy -celery -redis \ No newline at end of file +sqlalchemy==2.0.51 +celery==5.6.3 +redis==8.0.1 + +# Removed (2026-07): gradio and wandb — neither is imported anywhere in the +# codebase (training sets WANDB_DISABLED=true), and gradio pulls a large, +# unused dependency tree. Re-add with a pin if a demo UI / W&B logging is built.