From b84d5ecf1ecf83b3dcd994526a6938ed2908b989 Mon Sep 17 00:00:00 2001 From: Olivier Dulcy Date: Tue, 5 Nov 2024 17:00:03 +0100 Subject: [PATCH 1/6] bump: :arrow_up: CUDA Version --- Dockerfile | 30 +++++++++++++++--------------- README.md | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index beb8c8693e..3f9fea8aba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,22 +16,22 @@ RUN if [ "$SYSTEM" = "gpu" ]; then \ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \ dpkg -i cuda-keyring_1.1-1_all.deb && \ apt-get update && apt-get install -y --no-install-recommends \ - cuda-command-line-tools-11-8 \ - cuda-cudart-dev-11-8 \ - cuda-nvcc-11-8 \ - cuda-cupti-11-8 \ - cuda-nvprune-11-8 \ - cuda-libraries-11-8 \ - cuda-nvrtc-11-8 \ - libcufft-11-8 \ - libcurand-11-8 \ - libcusolver-11-8 \ - libcusparse-11-8 \ - libcublas-11-8 \ + cuda-command-line-tools-12-3 \ + cuda-cudart-dev-12-3 \ + cuda-nvcc-12-3 \ + cuda-cupti-12-3 \ + cuda-nvprune-12-3 \ + cuda-libraries-12-3 \ + cuda-nvrtc-12-3 \ + libcufft-12-3 \ + libcurand-12-3 \ + libcusolver-12-3 \ + libcusparse-12-3 \ + libcublas-12-3 \ # - CuDNN: https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#ubuntu-network-installation - libcudnn8=8.6.0.163-1+cuda11.8 \ - libnvinfer-plugin8=8.6.1.6-1+cuda11.8 \ - libnvinfer8=8.6.1.6-1+cuda11.8; \ + libcudnn8=8.9.6.50-1+cuda12.2 \ + libnvinfer-plugin8=8.6.1.6-1+cuda12.0 \ + libnvinfer8=8.6.1.6-1+cuda12.0; \ fi RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/README.md b/README.md index 7231a64c3a..2c8460ddf8 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ Check out our [TensorFlow.js demo](https://github.com/mindee/doctr-tfjs-demo) to #### Using GPU with docTR Docker Images -The docTR Docker images are GPU-ready and based on CUDA `11.8`. +The docTR Docker images are GPU-ready and based on CUDA `12.3`. However, to use GPU support with these Docker images, please ensure that Docker is configured to use your GPU. To verify and configure GPU support for Docker, please follow the instructions provided in the [NVIDIA Container Toolkit Installation Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html). From b512e142ce8e62cf072de85850ac34a785b48d4a Mon Sep 17 00:00:00 2001 From: Olivier Dulcy Date: Tue, 5 Nov 2024 18:11:56 +0100 Subject: [PATCH 2/6] upd --- .github/workflows/public_docker_images.yml | 12 +++++++++--- README.md | 9 +++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/public_docker_images.yml b/.github/workflows/public_docker_images.yml index 8d4e929391..2b29a4b661 100644 --- a/.github/workflows/public_docker_images.yml +++ b/.github/workflows/public_docker_images.yml @@ -42,6 +42,12 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Sanitize docker tag + run: + PREFIX_DOCKER_TAG="${{ matrix.framework }}-py${{ matrix.python }}-${{ matrix.system }}-" + PREFIX_DOCKER_TAG=$(echo PREFIX_DOCKER_TAG|sed 's/,/-/g') + echo PREFIX_DOCKER_TAG=${PREFIX_DOCKER_TAG} >> $GITHUB_ENV + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 @@ -49,9 +55,9 @@ jobs: images: ${{ env.REGISTRY }}/${{ github.repository }} tags: | # used only on schedule event - type=schedule,pattern={{date 'YYYY-MM'}},prefix=${{ matrix.framework }}-py${{ matrix.python }}-${{ matrix.system }}- + type=schedule,pattern={{date 'YYYY-MM'}},prefix=${{ env.PREFIX_DOCKER_TAG }} # used only if a tag following semver is published - type=semver,pattern={{raw}},prefix=${{ matrix.framework }}-py${{ matrix.python }}-${{ matrix.system }}- + type=semver,pattern={{raw}},prefix=${{ env.PREFIX_DOCKER_TAG }} - name: Build Docker image id: build @@ -72,7 +78,7 @@ jobs: - name: Push Docker image # Push only if the CI is not triggered by "PR on main" - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + if: ${{ (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || (startsWith(github.ref, 'refs/tags') && github.event_name == 'push') }} uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: context: . diff --git a/README.md b/README.md index 2c8460ddf8..a7805448d0 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ Check out our [TensorFlow.js demo](https://github.com/mindee/doctr-tfjs-demo) to ### Docker container -[We offer Docker container support for easy testing and deployment](https://github.com/mindee/doctr/pkgs/container/doctr). +We offer Docker container support for easy testing and deployment. [Here are the available docker tags.](https://github.com/mindee/doctr/pkgs/container/doctr). #### Using GPU with docTR Docker Images @@ -274,17 +274,18 @@ docker run -it --gpus all ghcr.io/mindee/doctr:tf-py3.8.18-gpu-2023-09 bash The Docker images for docTR follow a specific tag nomenclature: `-py--`. Here's a breakdown of the tag structure: - ``: `tf` (TensorFlow) or `torch` (PyTorch). -- ``: `3.8.18`, `3.9.18`, or `3.10.13`. +- ``: `3.9.18`, `3.10.13` or `3.11.8`. - ``: `cpu` or `gpu` - ``: a tag >= `v0.7.1` -- ``: e.g. `2023-09` +- ``: e.g. `2014-10` Here are examples of different image tags: | Tag | Description | |----------------------------|---------------------------------------------------| | `tf-py3.8.18-cpu-v0.7.1` | TensorFlow version `3.8.18` with docTR `v0.7.1`. | -| `torch-py3.9.18-gpu-2023-09`| PyTorch version `3.9.18` with GPU support and a monthly build from `2023-09`. | +| `tf-py3.11.8-cpu-2024-10` | TensorFlow version `3.11.8` with docTR from latest commit on `main` in `2024-10`. | +| `torch-py3.11.8-gpu-2024-10`| PyTorch version `3.11.8` with GPU support from latest commit on `main` in `2024-10`. | #### Building Docker Images Locally From 36185f770317706a1b8ff14490efca65ec21dc23 Mon Sep 17 00:00:00 2001 From: Olivier Dulcy Date: Fri, 15 Nov 2024 14:17:27 +0100 Subject: [PATCH 3/6] bump --- .github/workflows/public_docker_images.yml | 5 +--- Dockerfile | 33 ++-------------------- README.md | 19 ++++++------- pyproject.toml | 4 +-- 4 files changed, 14 insertions(+), 47 deletions(-) diff --git a/.github/workflows/public_docker_images.yml b/.github/workflows/public_docker_images.yml index 2b29a4b661..66a7322886 100644 --- a/.github/workflows/public_docker_images.yml +++ b/.github/workflows/public_docker_images.yml @@ -24,7 +24,6 @@ jobs: # Must match version at https://www.python.org/ftp/python/ python: ["3.10.13", "3.11.8", "3.12.7"] framework: ["tf", "torch", "tf,viz,html,contrib", "torch,viz,html,contrib"] - system: ["cpu", "gpu"] # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. permissions: @@ -44,7 +43,7 @@ jobs: - name: Sanitize docker tag run: - PREFIX_DOCKER_TAG="${{ matrix.framework }}-py${{ matrix.python }}-${{ matrix.system }}-" + PREFIX_DOCKER_TAG="${{ matrix.framework }}-py${{ matrix.python }}-" PREFIX_DOCKER_TAG=$(echo PREFIX_DOCKER_TAG|sed 's/,/-/g') echo PREFIX_DOCKER_TAG=${PREFIX_DOCKER_TAG} >> $GITHUB_ENV @@ -67,7 +66,6 @@ jobs: build-args: | FRAMEWORK=${{ matrix.framework }} PYTHON_VERSION=${{ matrix.python }} - SYSTEM=${{ matrix.system }} DOCTR_REPO=${{ github.repository }} DOCTR_VERSION=${{ github.sha }} push: false # push only if `import doctr` works @@ -85,7 +83,6 @@ jobs: build-args: | FRAMEWORK=${{ matrix.framework }} PYTHON_VERSION=${{ matrix.python }} - SYSTEM=${{ matrix.system }} DOCTR_REPO=${{ github.repository }} DOCTR_VERSION=${{ github.sha }} push: true diff --git a/Dockerfile b/Dockerfile index 3f9fea8aba..fd89c849f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,10 @@ -FROM ubuntu:22.04 +FROM nvidia/cuda:12.2.0-base-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV LANG=C.UTF-8 ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 -ARG SYSTEM=gpu - -# Enroll NVIDIA GPG public key and install CUDA -RUN if [ "$SYSTEM" = "gpu" ]; then \ - apt-get update && \ - apt-get install -y gnupg ca-certificates wget && \ - # - Install Nvidia repo keys - # - See: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#network-repo-installation-for-ubuntu - wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \ - dpkg -i cuda-keyring_1.1-1_all.deb && \ - apt-get update && apt-get install -y --no-install-recommends \ - cuda-command-line-tools-12-3 \ - cuda-cudart-dev-12-3 \ - cuda-nvcc-12-3 \ - cuda-cupti-12-3 \ - cuda-nvprune-12-3 \ - cuda-libraries-12-3 \ - cuda-nvrtc-12-3 \ - libcufft-12-3 \ - libcurand-12-3 \ - libcusolver-12-3 \ - libcusparse-12-3 \ - libcublas-12-3 \ - # - CuDNN: https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#ubuntu-network-installation - libcudnn8=8.9.6.50-1+cuda12.2 \ - libnvinfer-plugin8=8.6.1.6-1+cuda12.0 \ - libnvinfer8=8.6.1.6-1+cuda12.0; \ -fi RUN apt-get update && apt-get install -y --no-install-recommends \ # - Other packages @@ -48,8 +20,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # - Packages for docTR libgl1-mesa-dev libsm6 libxext6 libxrender-dev libpangocairo-1.0-0 \ && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ -fi + && rm -rf /var/lib/apt/lists/* # Install Python ARG PYTHON_VERSION=3.10.13 diff --git a/README.md b/README.md index a7805448d0..c735f8789f 100644 --- a/README.md +++ b/README.md @@ -258,34 +258,33 @@ We offer Docker container support for easy testing and deployment. [Here are the #### Using GPU with docTR Docker Images -The docTR Docker images are GPU-ready and based on CUDA `12.3`. -However, to use GPU support with these Docker images, please ensure that Docker is configured to use your GPU. +The docTR Docker images are GPU-ready and based on CUDA `12.2`. +Please ensure that Docker is configured to use your GPU. To verify and configure GPU support for Docker, please follow the instructions provided in the [NVIDIA Container Toolkit Installation Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html). Once Docker is configured to use GPUs, you can run docTR Docker containers with GPU support: ```shell -docker run -it --gpus all ghcr.io/mindee/doctr:tf-py3.8.18-gpu-2023-09 bash +docker run -it --gpus all ghcr.io/mindee/doctr:torch-py3.9.18-2024-10 bash ``` #### Available Tags -The Docker images for docTR follow a specific tag nomenclature: `-py--`. Here's a breakdown of the tag structure: +The Docker images for docTR follow a specific tag nomenclature: `-py-`. Here's a breakdown of the tag structure: -- ``: `tf` (TensorFlow) or `torch` (PyTorch). +- ``: `tf`, `torch`, `tf-viz-html-contrib` or `torch-viz-html-contrib`. - ``: `3.9.18`, `3.10.13` or `3.11.8`. -- ``: `cpu` or `gpu` -- ``: a tag >= `v0.7.1` +- ``: a tag >= `v0.11.0` - ``: e.g. `2014-10` Here are examples of different image tags: | Tag | Description | |----------------------------|---------------------------------------------------| -| `tf-py3.8.18-cpu-v0.7.1` | TensorFlow version `3.8.18` with docTR `v0.7.1`. | -| `tf-py3.11.8-cpu-2024-10` | TensorFlow version `3.11.8` with docTR from latest commit on `main` in `2024-10`. | -| `torch-py3.11.8-gpu-2024-10`| PyTorch version `3.11.8` with GPU support from latest commit on `main` in `2024-10`. | +| `tf-py3.10.13-v0.11.0` | TensorFlow version `3.10.13` with docTR `v0.11.0`. | +| `torch-viz-html-contrib-py3.11.8-2024-10` | Torch with extra dependencies version `3.11.8` from latest commit on `main` in `2024-10`. | +| `torch-py3.11.8-2024-10`| PyTorch version `3.11.8` from latest commit on `main` in `2024-10`. | #### Building Docker Images Locally diff --git a/pyproject.toml b/pyproject.toml index 763e966187..3be3ca8700 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ dependencies = [ [project.optional-dependencies] tf = [ # cf. https://github.com/mindee/doctr/pull/1461 - "tensorflow>=2.15.0,<3.0.0", + "tensorflow[and-cuda]>=2.15.0,<3.0.0", "tf-keras>=2.15.0,<3.0.0", # Keep keras 2 compatibility "tf2onnx>=1.16.0,<2.0.0", # cf. https://github.com/onnx/tensorflow-onnx/releases/tag/v1.16.0 ] @@ -97,7 +97,7 @@ docs = [ dev = [ # Tensorflow # cf. https://github.com/mindee/doctr/pull/1461 - "tensorflow>=2.15.0,<3.0.0", + "tensorflow[and-cuda]>=2.15.0,<3.0.0", "tf-keras>=2.15.0,<3.0.0", # Keep keras 2 compatibility "tf2onnx>=1.16.0,<2.0.0", # cf. https://github.com/onnx/tensorflow-onnx/releases/tag/v1.16.0 # PyTorch From a6bce91aa89403dc2a377229bbdec4a71805219d Mon Sep 17 00:00:00 2001 From: Olivier Dulcy Date: Fri, 15 Nov 2024 14:20:14 +0100 Subject: [PATCH 4/6] edit README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c735f8789f..3cf997b7bd 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ We offer Docker container support for easy testing and deployment. [Here are the #### Using GPU with docTR Docker Images -The docTR Docker images are GPU-ready and based on CUDA `12.2`. +The docTR Docker images are GPU-ready and based on CUDA `12.2`. Make sure your host is **at least `12.2`**, otherwise Torch or TensorFlow won't be able to initialize the GPU. Please ensure that Docker is configured to use your GPU. To verify and configure GPU support for Docker, please follow the instructions provided in the [NVIDIA Container Toolkit Installation Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html). From d8763e9086bec3d8d7a3f0e469e4c063e20ed271 Mon Sep 17 00:00:00 2001 From: Olivier Dulcy Date: Mon, 18 Nov 2024 11:07:10 +0100 Subject: [PATCH 5/6] sys_platform == 'darwin' --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3be3ca8700..e94ccfe381 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,8 @@ dependencies = [ [project.optional-dependencies] tf = [ # cf. https://github.com/mindee/doctr/pull/1461 - "tensorflow[and-cuda]>=2.15.0,<3.0.0", + "tensorflow[and-cuda]>=2.15.0,<3.0.0; sys_platform != 'darwin'", + "tensorflow>=2.15.0,<3.0.0; sys_platform == 'darwin'", # TensorFlow compatible for macOS "tf-keras>=2.15.0,<3.0.0", # Keep keras 2 compatibility "tf2onnx>=1.16.0,<2.0.0", # cf. https://github.com/onnx/tensorflow-onnx/releases/tag/v1.16.0 ] From 84325af95e1b0510bf39c0e8d5f38c904c771068 Mon Sep 17 00:00:00 2001 From: Olivier Dulcy Date: Mon, 18 Nov 2024 11:24:16 +0100 Subject: [PATCH 6/6] upd --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e94ccfe381..59b159fb9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,7 +98,8 @@ docs = [ dev = [ # Tensorflow # cf. https://github.com/mindee/doctr/pull/1461 - "tensorflow[and-cuda]>=2.15.0,<3.0.0", + "tensorflow[and-cuda]>=2.15.0,<3.0.0; sys_platform != 'darwin'", + "tensorflow>=2.15.0,<3.0.0; sys_platform == 'darwin'", # TensorFlow compatible for macOS "tf-keras>=2.15.0,<3.0.0", # Keep keras 2 compatibility "tf2onnx>=1.16.0,<2.0.0", # cf. https://github.com/onnx/tensorflow-onnx/releases/tag/v1.16.0 # PyTorch