FROM pytorch/pytorch:2.8.0-cuda12.8-cudnn9-runtime (#21675)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2025-08-13 13:33:09 +02:00 committed by GitHub
parent d58e26db05
commit 9c56d4a15a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 18 deletions

View File

@ -17,7 +17,7 @@ on:
inputs:
Dockerfile:
type: boolean
description: Dockerfile (+ runner)
description: Dockerfile (+ runner, export)
default: true
Dockerfile-python:
type: boolean
@ -61,7 +61,7 @@ jobs:
tags: "latest"
platforms: "linux/amd64"
runs_on: "ubuntu-latest"
derivatives: "Dockerfile-runner"
derivatives: "Dockerfile-runner,Dockerfile-export"
- dockerfile: "Dockerfile-python"
tags: "latest-python"
platforms: "linux/amd64"
@ -210,15 +210,15 @@ jobs:
- name: Check Environment
if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && (matrix.platforms == 'linux/amd64' || matrix.platforms == 'linux/arm64') && matrix.dockerfile != 'Dockerfile-conda'
run: docker run ultralytics/ultralytics:${{ matrix.tags == 'latest-python' && 'latest-python-export' || matrix.tags }} /bin/bash -c "yolo checks && uv pip list"
run: docker run ultralytics/ultralytics:${{ (matrix.tags == 'latest-python' && 'latest-python-export') || (matrix.tags == 'latest' && 'latest-export') || matrix.tags }} /bin/bash -c "yolo checks && uv pip list"
- name: Run Tests
if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && (matrix.platforms == 'linux/amd64' || matrix.platforms == 'linux/arm64') && matrix.dockerfile != 'Dockerfile-conda'
run: docker run ultralytics/ultralytics:${{ matrix.tags == 'latest-python' && 'latest-python-export' || matrix.tags }} /bin/bash -c "pip install pytest && pytest tests"
run: docker run ultralytics/ultralytics:${{ (matrix.tags == 'latest-python' && 'latest-python-export') || (matrix.tags == 'latest' && 'latest-export') || matrix.tags }} /bin/bash -c "pip install pytest && pytest tests"
- name: Run Benchmarks
if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && (matrix.platforms == 'linux/amd64' || matrix.dockerfile == 'Dockerfile-arm64') && matrix.dockerfile != 'Dockerfile' && matrix.dockerfile != 'Dockerfile-conda'
run: docker run ultralytics/ultralytics:${{ matrix.tags == 'latest-python' && 'latest-python-export' || matrix.tags }} yolo benchmark model=yolo11n.pt imgsz=160 verbose=0.309
run: docker run ultralytics/ultralytics:${{ (matrix.tags == 'latest-python' && 'latest-python-export') || (matrix.tags == 'latest' && 'latest-export') || matrix.tags }} yolo benchmark model=yolo11n.pt imgsz=160 verbose=0.309
- name: Push All Images
if: github.event_name == 'push' || (github.event.inputs[matrix.dockerfile] == 'true' && github.event.inputs.push == 'true')

View File

@ -4,7 +4,7 @@
# Image is CUDA-optimized for YOLO single/multi-GPU training and inference
# Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch or nvcr.io/nvidia/pytorch:25.02-py3
FROM pytorch/pytorch:2.7.0-cuda12.6-cudnn9-runtime
FROM pytorch/pytorch:2.8.0-cuda12.8-cudnn9-runtime
# Set environment variables
# Avoid DDP error "MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library"
@ -40,14 +40,10 @@ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
ADD https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt .
# Install pip packages and run exports to AutoInstall packages
# Install pip packages
RUN pip install uv && \
uv pip install --system -e ".[export]" albumentations faster-coco-eval "onnxruntime-gpu" tensorrt wandb && \
# Run exports to AutoInstall packages
yolo export model=tmp/yolo11n.pt format=edgetpu imgsz=32 && \
yolo export model=tmp/yolo11n.pt format=ncnn imgsz=32 && \
uv pip install --system paddlepaddle x2paddle && \
# Remove extra build files
uv pip install --system -e "." albumentations faster-coco-eval wandb && \
# Remove extra build files \
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
# Usage Examples -------------------------------------------------------------------------------------------------------

15
docker/Dockerfile-export Normal file
View File

@ -0,0 +1,15 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# Export-optimized derivative of ultralytics/ultralytics:latest for testing and benchmarks
# Includes all export format dependencies and pre-installed export packages
FROM ultralytics/ultralytics:latest
# Install export dependencies and run exports to AutoInstall packages
# Numpy 1.26.4 required due to TF export bug with torch 2.8
RUN uv pip install --system -e ".[export]" "onnxruntime-gpu" tensorrt paddlepaddle x2paddle numpy==1.26.4 && \
# Run exports to AutoInstall packages \
yolo export model=yolo11n.pt format=edgetpu imgsz=32 && \
yolo export model=yolo11n.pt format=ncnn imgsz=32 && \
# Remove temporary files \
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json

View File

@ -7,11 +7,7 @@
FROM ultralytics/ultralytics:latest
# Set additional environment variables for runner
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_BREAK_SYSTEM_PACKAGES=1 \
RUNNER_ALLOW_RUNASROOT=1 \
ENV RUNNER_ALLOW_RUNASROOT=1 \
DEBIAN_FRONTEND=noninteractive
# Set the working directory