From da095a7e3c149f4089c6bc1d5d8d4838702228e8 Mon Sep 17 00:00:00 2001 From: Fabien Racape Date: Wed, 7 Oct 2026 17:04:03 -0700 Subject: [PATCH 1/5] chores: allow torchvision>=0.14.1 below Python 3.12 --- .gitlab-ci.yml | 5 +++++ pyproject.toml | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf97074e..4e240f9f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -113,6 +113,10 @@ test: CUDA_VERSION_NAME=cu116 TORCH_VERSION=1.13.1+cu116 TORCHVISION_VERSION=0.14.1+cu116 + elif [ "$PYTORCH_IMAGE" == "2.0.0-cuda11.8-cudnn8-devel" ]; then + CUDA_VERSION_NAME=cu118 + TORCH_VERSION=2.0.0+cu118 + TORCHVISION_VERSION=0.15.1+cu118 elif [ "$PYTORCH_IMAGE" == "2.2.0-cuda11.8-cudnn8-devel" ]; then CUDA_VERSION_NAME=cu118 TORCH_VERSION=2.2.0+cu118 @@ -173,6 +177,7 @@ test: matrix: - PYTORCH_IMAGE: - "1.13.1-cuda11.6-cudnn8-devel" + - "2.0.0-cuda11.8-cudnn8-devel" # MPEG FCM CTTC (py3.10) stack - "2.2.0-cuda11.8-cudnn8-devel" tags: - docker diff --git a/pyproject.toml b/pyproject.toml index 75b051bb..c0ecba10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,11 @@ dependencies = [ "torch>=1.13.1", "torch>=2.6.0; python_version >= '3.12'", "torchvision>=0.14.1,<0.20; python_version < '3.9'", - "torchvision>=0.17.0; python_version >= '3.9'", + # torchvision 0.14.1-0.16.x are supported below Python 3.12 (exercised by the + # 1.13.1 and 2.0.0 CI images; 2.0.0/0.15.1 is the MPEG FCM CTTC py3.10 stack). + # torchvision 0.17 is the first release with Python 3.12 wheels. + "torchvision>=0.14.1; python_version >= '3.9' and python_version < '3.12'", + "torchvision>=0.17.0; python_version >= '3.12'", "tqdm", "typing-extensions>=4.0.0", "wheel>=0.32.0", # For --no-build-isolation. From 19eb6d9dfa1a9ebe003aaf9cd2b22cb9c68ca817 Mon Sep 17 00:00:00 2001 From: Fabien Racape Date: Wed, 7 Oct 2026 17:09:52 -0700 Subject: [PATCH 2/5] chores: regenerate uv.lock for torchvision>=0.14.1 below Python 3.12 --- uv.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 68898bc9..2e283171 100644 --- a/uv.lock +++ b/uv.lock @@ -752,7 +752,8 @@ requires-dist = [ { name = "torch", marker = "python_full_version >= '3.12'", specifier = ">=2.6.0" }, { name = "torch-geometric", specifier = ">=2.3.0" }, { name = "torchvision", marker = "python_full_version < '3.9'", specifier = ">=0.14.1,<0.20" }, - { name = "torchvision", marker = "python_full_version >= '3.9'", specifier = ">=0.17.0" }, + { name = "torchvision", marker = "python_full_version >= '3.9' and python_full_version < '3.12'", specifier = ">=0.14.1" }, + { name = "torchvision", marker = "python_full_version >= '3.12'", specifier = ">=0.17.0" }, { name = "tqdm" }, { name = "typing-extensions", specifier = ">=4.0.0" }, { name = "wheel", specifier = ">=0.32.0" }, From e444fab57c8ec409af1e02e6aeb84212678d3f6b Mon Sep 17 00:00:00 2001 From: Fabien Racape Date: Wed, 7 Oct 2026 23:00:39 -0700 Subject: [PATCH 3/5] CI: test torch 2.0.0+cu118 / torchvision 0.15.1 on the 2.2.0 cu118 image --- .gitlab-ci.yml | 16 ++++++++++------ pyproject.toml | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e240f9f..2eec71b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -109,14 +109,16 @@ test: before_script: - *default-before-script - | - if [ "$PYTORCH_IMAGE" == "1.13.1-cuda11.6-cudnn8-devel" ]; then - CUDA_VERSION_NAME=cu116 - TORCH_VERSION=1.13.1+cu116 - TORCHVISION_VERSION=0.14.1+cu116 - elif [ "$PYTORCH_IMAGE" == "2.0.0-cuda11.8-cudnn8-devel" ]; then + if [ "${TORCH_OVERRIDE:-}" == "2.0.0" ]; then + # No torch 2.0.0 + CUDA 11.8 image is published: reuse the 2.2.0 cu118 + # image (Python 3.10, CUDA 11.8) and install torch 2.0.0+cu118. CUDA_VERSION_NAME=cu118 TORCH_VERSION=2.0.0+cu118 TORCHVISION_VERSION=0.15.1+cu118 + elif [ "$PYTORCH_IMAGE" == "1.13.1-cuda11.6-cudnn8-devel" ]; then + CUDA_VERSION_NAME=cu116 + TORCH_VERSION=1.13.1+cu116 + TORCHVISION_VERSION=0.14.1+cu116 elif [ "$PYTORCH_IMAGE" == "2.2.0-cuda11.8-cudnn8-devel" ]; then CUDA_VERSION_NAME=cu118 TORCH_VERSION=2.2.0+cu118 @@ -177,8 +179,10 @@ test: matrix: - PYTORCH_IMAGE: - "1.13.1-cuda11.6-cudnn8-devel" - - "2.0.0-cuda11.8-cudnn8-devel" # MPEG FCM CTTC (py3.10) stack - "2.2.0-cuda11.8-cudnn8-devel" + # torch 2.0.0+cu118 / torchvision 0.15.1 on the 2.2.0 cu118 image. + - PYTORCH_IMAGE: "2.2.0-cuda11.8-cudnn8-devel" + TORCH_OVERRIDE: "2.0.0" tags: - docker diff --git a/pyproject.toml b/pyproject.toml index c0ecba10..49f9efca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,8 +45,8 @@ dependencies = [ "torch>=2.6.0; python_version >= '3.12'", "torchvision>=0.14.1,<0.20; python_version < '3.9'", # torchvision 0.14.1-0.16.x are supported below Python 3.12 (exercised by the - # 1.13.1 and 2.0.0 CI images; 2.0.0/0.15.1 is the MPEG FCM CTTC py3.10 stack). - # torchvision 0.17 is the first release with Python 3.12 wheels. + # torch 1.13.1 and 2.0.0 CI jobs). torchvision 0.17 is the first release with + # Python 3.12 wheels. "torchvision>=0.14.1; python_version >= '3.9' and python_version < '3.12'", "torchvision>=0.17.0; python_version >= '3.12'", "tqdm", From c1e802225dc8ce490ce57399f0c6c167daf5833e Mon Sep 17 00:00:00 2001 From: Fabien Racape Date: Wed, 28 Oct 2026 22:47:29 -0700 Subject: [PATCH 4/5] ci: fix handling when timm is absent --- tests/test_mlicv2_layers.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/test_mlicv2_layers.py b/tests/test_mlicv2_layers.py index 0bb05366..5b552da8 100644 --- a/tests/test_mlicv2_layers.py +++ b/tests/test_mlicv2_layers.py @@ -37,15 +37,20 @@ import compressai.layers as layers -from compressai.models._helpers.mlicv2 import ( - ContextReweighting, - GSCModule, - HGCPModule, - RoPE2D, - SimpleTokenMixing, - STMAnalysis, - STMSynthesis, -) +try: + from compressai.models._helpers.mlicv2 import ( + ContextReweighting, + GSCModule, + HGCPModule, + RoPE2D, + SimpleTokenMixing, + STMAnalysis, + STMSynthesis, + ) +except ModuleNotFoundError as err: + if err.name != "timm": + raise + pytestmark = pytest.mark.skip(reason="MLICv2 layers require the [attn] extra") def _round_trip_output( From f8edec7576167c03d0c345e34d9533b6180c6248 Mon Sep 17 00:00:00 2001 From: Fabien Racape Date: Wed, 28 Oct 2026 22:55:45 -0700 Subject: [PATCH 5/5] CI: install attention dependencies for tests --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2eec71b7..9e17cfd7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -166,7 +166,7 @@ test: update_dict(base, delta) Path("pyproject.toml").write_text(tomlkit.dumps(base)) EOF - - uv sync --group=test --reinstall + - uv sync --group=test --extra=attn --reinstall - *check-torch-cuda - | PYTEST_ARGS=(--cov=compressai --capture=no tests)