Skip to content

Commit 6496b96

Browse files
Bump pytorch 2.9.0 (#3690)
### Changes - Updated `torch` to version 2.9.0 and `torchvision` to version 0.24.0 - some examples still used 2.8.0 until update optimum ``` from torch.onnx.symbolic_opset14 import ( # noqa: E402 ImportError: cannot import name '_attention_scale' from 'torch.onnx.symbolic_opset14' (/tmp/pytest-of-runner/pytest-0/test_examples_llm_compression_0/venv/lib/python3.10/site-packages/torch/onnx/symbolic_opset14.py) ``` - Set `dynamo=False` in all calls to `torch.onnx.export` throughout the codebase and tests to ensure compatibility with PyTorch 2.9.0 and work around issues with the `ultralytics` library. - Applied a workaround in scripts using `ultralytics` to set the default value for the `dynamo` parameter in `torch.onnx.export`, with a TODO to remove after upstream fixes. - Use `check_guards=False` for FX model to no add extra function to model - Update referenced FX graphs, in reason of fused `slice` and `select` operations ### Tests manual/job/post_training_quantization/738/ https://github.com/openvinotoolkit/nncf/actions/runs/18719524116 https://github.com/openvinotoolkit/nncf/actions/runs/18720059603 nightly/job/torch_nightly/687/
1 parent d103052 commit 6496b96

File tree

93 files changed

+31507
-33048
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+31507
-33048
lines changed

constraints.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
openvino==2025.3.0
33

44
# Pytorch
5-
torch==2.8.0
6-
torchvision==0.23.0
5+
torch==2.9.0
6+
torchvision==0.24.0
77

88
# ONNX
99
onnx==1.17.0; python_version < '3.13'
1010
onnx==1.18.0; python_version >= '3.13'
1111
onnxruntime==1.21.1
12+
onnxscript==0.5.4
1213

1314
# TensorFlow
1415
tensorflow==2.15.1

docs/Installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ as well as the supported versions of Python:
4949

5050
| NNCF | OpenVINO | PyTorch | ONNX | TensorFlow | Python |
5151
|-----------|------------|----------|----------|------------|--------|
52-
| `develop` | `2025.3.0` | `2.8.0` | `1.17.0` | `2.15.1` | `3.10` |
52+
| `develop` | `2025.3.0` | `2.9.0` | `1.17.0` | `2.15.1` | `3.10` |
5353
| `2.18.0` | `2025.3.0` | `2.8.0` | `1.17.0` | `2.15.1` | `3.10` |
5454
| `2.17.0` | `2025.2.0` | `2.7.1` | `1.17.0` | `2.15.1` | `3.10` |
5555
| `2.16.0` | `2025.1.0` | `2.6.0` | `1.17.0` | `2.15.1` | `3.10` |
@@ -70,4 +70,4 @@ as well as the supported versions of Python:
7070

7171
> (*) Python 3.9 or higher is required for TensorFlow 2.15.1
7272
73-
This repository is tested on Python* 3.10.14, PyTorch* 2.8.0 (NVidia CUDA\* Toolkit 12.6) and TensorFlow* 2.15.1 (NVidia CUDA\* Toolkit 11.8).
73+
This repository is tested on Python* 3.10.14, PyTorch* 2.9.0 (NVidia CUDA\* Toolkit 12.6) and TensorFlow* 2.15.1 (NVidia CUDA\* Toolkit 11.8).

examples/llm_compression/openvino/tiny_llama_find_hyperparams/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ openvino==2025.3.0
44
optimum-intel==1.24.0
55
transformers==4.52.1
66
onnx==1.17.0
7-
torch==2.8.0
7+
torch==2.9.0

examples/llm_compression/torch_fx/tiny_llama/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ transformers==4.52.1
22
datasets==2.14.7
33
openvino==2025.3.0
44
optimum==1.24.0
5-
torch==2.8.0
6-
torchvision==0.23.0
5+
torch==2.9.0
6+
torchvision==0.24.0

examples/post_training_quantization/onnx/mobilenet_v2/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
torch==2.8.0
2-
torchvision==0.23.0
1+
torch==2.9.0
2+
torchvision==0.24.0
33
fastdownload==0.0.7
44
onnx==1.17.0
55
onnxruntime==1.21.1

examples/post_training_quantization/onnx/yolov8_quantize_with_accuracy_control/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
ROOT = Path(__file__).parent.resolve()
3535

3636

37+
# WA: to set default value for dynamo parameter to False
38+
# TODO(AlexanderDokuchaev): remove after update ultralytics
39+
torch.onnx.export = partial(torch.onnx.export, dynamo=False)
40+
41+
3742
def validate(
3843
model: onnx.ModelProto,
3944
data_loader: torch.utils.data.DataLoader,

examples/post_training_quantization/openvino/yolov8/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# limitations under the License.
1111
import re
1212
import subprocess
13+
from functools import partial
1314
from pathlib import Path
1415
from typing import Any
1516

@@ -32,6 +33,11 @@
3233
ROOT = Path(__file__).parent.resolve()
3334

3435

36+
# WA: to set default value for dynamo parameter to False
37+
# TODO(AlexanderDokuchaev): remove after update ultralytics
38+
torch.onnx.export = partial(torch.onnx.export, dynamo=False)
39+
40+
3541
def validate(
3642
model: ov.Model, data_loader: torch.utils.data.DataLoader, validator: DetectionValidator, num_samples: int = None
3743
) -> tuple[dict, int, int]:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
ultralytics==8.3.22
22
onnx==1.17.0
33
openvino==2025.3.0
4-
torch==2.8.0
4+
torch==2.9.0

examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333

3434
ROOT = Path(__file__).parent.resolve()
3535

36+
# WA: to set default value for dynamo parameter to False
37+
# TODO(AlexanderDokuchaev): remove after update ultralytics
38+
torch.onnx.export = partial(torch.onnx.export, dynamo=False)
39+
3640

3741
def validate(
3842
model: ov.Model, data_loader: torch.utils.data.DataLoader, validator: SegmentationValidator, num_samples: int = None
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
ultralytics==8.3.22
22
onnx==1.17.0
33
openvino==2025.3.0
4-
torch==2.8.0
4+
torch==2.9.0

0 commit comments

Comments
 (0)