22. Production Deployment
Production deployment of multimodal video systems requires engineering beyond model accuracy. Reliability, monitoring, and graceful degradation determine whether a system delivers value in production.
Containerization with Docker encapsulates the inference environment including model weights, dependencies, and configuration. Multi-stage builds minimize image size by separating build dependencies from runtime. Kubernetes provides orchestration for scaling inference across multiple replicas.
# Multi-stage build for inference container
FROM nvidia/cuda:12.1-runtime-ubuntu22.04 as builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
FROM nvidia/cuda:12.1-runtime-ubuntu22.04
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY model/ ./model/
COPY app/ ./app/
ENV PYTHONUNBUFFERED=1
CMD ["python", "-m", "app.inference_server"]
Health checks verify inference capability, not just process aliveness. A model that loads but produces garbage outputs should trigger alert and recovery. Periodic validation against known inputs with expected outputs catches silent failures that model weights corruption or numerical instability cause.
Model versioning enables rollback when regressions occur. Store model artifacts in versioned storage (S3, GCS) with metadata including training dataset, hyperparameters, and evaluation metrics. A/B testing infrastructure routes traffic between model versions to detect performance differences before full rollout.
Local verification checkpoint
Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.
Local verification checkpoint
Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.
Deploy a video inference model to a cloud instance with Docker. Set up Prometheus metrics, configure health checks, and test rollback procedures.