Skip to content

Commit 3823804

Browse files
Bump transformers version (#3272)
### Changes - Bumped `transformers` version to `>=4.48.0` - Bumped `optimum-intel` version to `>=1.22.0` (as it requires `transformers`) - Bumped `optimum` version to `>=1.24.0` (as it requires `transformers`) - Updated statistics caching test with `position_ids` to fix: >Exception from src/plugins/intel_cpu/src/node.cpp:769: [CPU] Concat node with name '__module.model.model.decoder.layers.0.self_attn/aten::cat/Concat' Check 'TRShape::merge_into(output_shape, in_copy)' failed at src/core/shape_inference/include/concat_shape_inference.hpp:43: While validating node 'opset1::Concat __module.model.model.decoder.layers.0.self_attn/aten::cat/Concat (opset1::Parameter Parameter_753753[0]:f32[?,4,?,4], opset1::Transpose __module.model.model.decoder.layers.0.self_attn/aten::transpose/Transpose_1[0]:f32[?,4,?,4]) -> (f32[?,4,?,4])' with friendly_name '__module.model.model.decoder.layers.0.self_attn/aten::cat/Concat': Shape inference input shapes {{1,4,0,4},{0,4,0,4}} Argument shapes are inconsistent; they must have the same rank, and must have equal dimension everywhere except on the concatenation axis (axis 2). - Bumped `accelerate` version to `>=1.1.0` to fix: > NotImplementedError: data_seed requires Accelerate version `accelerate` >= 1.1.0. This is not supported and we recommend you to update your version. - Added `num_items_in_batch` to `compute_loss` to fix: > TypeError: CompressionTrainer.compute_loss() got an unexpected keyword argument 'num_items_in_batch' - Bumped `_ONNX_DEFAULT_OPSET` from 13 to 14 to fix: > torch.onnx.errors.UnsupportedOperatorError: Exporting the operator 'aten::scaled_dot_product_attention' to ONNX opset version 13 is not supported. Support for this operator was added in version 14, try exporting with this version. - Updated sparsity/pruning/nas references for tests. ### Reason for changes - Security issues with `transformers<4.48` ### Related tickets - N/A ### Tests - install - https://github.com/openvinotoolkit/nncf/actions/runs/13393410660 - passed - weight compression - https://github.com/openvinotoolkit/nncf/actions/runs/13393412141 - passed - examples - https://github.com/openvinotoolkit/nncf/actions/runs/13393412919 - passed - PTQ - manual/job/post_training_quantization/622/ - passed - PTWC - manual/job/post_training_weight_compression/327/ - passed --------- Co-authored-by: Nikolay Lyalyushkin <nikolay.lyalyushkin@intel.com>
1 parent 1511f32 commit 3823804

File tree

29 files changed

+1286
-2666
lines changed

29 files changed

+1286
-2666
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
datasets
22
openvino==2024.6
3-
optimum-intel[openvino]
4-
transformers
3+
optimum-intel[openvino]>=1.22.0
4+
transformers>=4.48.0
55
onnx==1.17.0
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
transformers
1+
transformers>=4.48.0
22
datasets==2.14.7
33
openvino==2025.0
4-
optimum-intel[openvino]
4+
optimum-intel[openvino]>=1.22.0
55
onnx==1.17.0

examples/llm_compression/openvino/tiny_llama_find_hyperparams/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ datasets
22
whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai#subdirectory=tools/who_what_benchmark
33
numpy>=1.23.5,<2
44
openvino==2025.0
5-
optimum-intel>=1.13.0
6-
transformers>=4.35.2
5+
optimum-intel>=1.22.0
6+
transformers>=4.48.0
77
onnx==1.17.0

examples/llm_compression/openvino/tiny_llama_synthetic_data/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ torch==2.5.1
22
datasets==3.0.1
33
numpy>=1.23.5,<2
44
openvino==2025.0
5-
optimum-intel>=1.13.0
6-
transformers>=4.35.2
5+
optimum-intel>=1.22.0
6+
transformers>=4.48.0
77
onnx==1.17.0

nncf/torch/exporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class PTExporter(Exporter):
7171
This class provides export of the compressed model to the ONNX format.
7272
"""
7373

74-
_ONNX_DEFAULT_OPSET = 13
74+
_ONNX_DEFAULT_OPSET = 14
7575

7676
@staticmethod
7777
def parse_format(save_format: str) -> Tuple[str, dict]:

tests/openvino/native/quantization/test_weights_compression_statistics_caching.py

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from typing import Tuple
1515

1616
import datasets
17+
import numpy as np
1718
import openvino as ov
1819
from optimum.intel.openvino import OVModelForCausalLM
1920
from transformers import AutoTokenizer
@@ -37,6 +38,11 @@ def transform_fn(data, model=model, tokenizer=tokenizer):
3738
input_ids = tokenized_text["input_ids"]
3839
inputs = {"input_ids": input_ids, "attention_mask": tokenized_text["attention_mask"]}
3940

41+
if "position_ids" in model.input_names:
42+
position_ids = np.cumsum(inputs["attention_mask"], axis=1) - 1
43+
position_ids[inputs["attention_mask"] == 0] = 1
44+
inputs["position_ids"] = position_ids
45+
4046
batch_size = input_ids.shape[0]
4147
if hasattr(model, "key_value_input_names"):
4248
for input_name in model.key_value_input_names:

tests/openvino/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ addict>=2.4.0
1313
timm==0.9.2
1414
efficientnet_pytorch==0.7.1
1515
datasets==3.0.1
16-
transformers==4.45.2
17-
optimum-intel==1.20.0
18-
optimum==1.23.1
16+
transformers==4.48.3
17+
optimum-intel==1.22.0
18+
optimum==1.24.0

tests/post_training/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ pytest-split
1010

1111
librosa==0.10.0
1212
memory-profiler==0.61.0
13-
optimum-intel==1.21.0
14-
optimum==1.23.3
13+
optimum-intel==1.22.0
14+
optimum==1.24.0
1515
scikit-learn>=1.2.2,<=1.5.0
1616
soundfile==0.12.1
1717
tensorboard==2.13.0
1818
tensorflow-io==0.32.0
1919
timm==0.9.2
20-
transformers==4.46.3
20+
transformers==4.48.3
2121
whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai.git@2025.0.0.0#subdirectory=tools/who_what_benchmark
2222
datasets==3.1.0

tests/torch/data/experimental/sparsify_activations/dummy_llama_int8_sym_weights_sparse_activations.dot

+491-477
Large diffs are not rendered by default.

tests/torch/data/experimental/sparsify_activations/dummy_llama_sparse_activations.dot

+431-417
Large diffs are not rendered by default.

tests/torch/data/reference_graphs/pruning_groups/1_layer_BERT.dot

+27-42
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,46 @@ strict digraph {
22
0 [color=grey, label="Block: S:1__O:0
33
Producers: 10
44
Consumers: ", style=filled];
5-
1 [color=grey, label="Block: S:64__O:0
5+
1 [color=red, label="Block: S:64__O:0
66
Producers: 10
77
Consumers: ", style=filled];
8-
2 [color=grey, label="Block: S:64__O:0
9-
Producers: 10,11
10-
Consumers: ", style=filled];
11-
3 [color=green, label="Block: S:64__O:0
12-
Producers: 10,11,14
13-
Consumers: 29", style=filled];
14-
4 [color=grey, label="Block: S:1__O:64
8+
2 [color=red, label="Block: S:1__O:64
159
Producers: 10
1610
Consumers: ", style=filled];
17-
5 [color=green, label="Block: S:1__O:64
18-
Producers: 10,11
19-
Consumers: 20", style=filled];
20-
6 [color=grey, label="Block: S:1__O:0
21-
Producers: 11
11+
3 [color=grey, label="Block: S:1__O:0
12+
Producers: 13
13+
Consumers: ", style=filled];
14+
4 [color=red, label="Block: S:64__O:0
15+
Producers: 13
2216
Consumers: ", style=filled];
23-
7 [color=grey, label="Block: S:64__O:0
24-
Producers: 11
17+
5 [color=red, label="Block: S:1__O:64
18+
Producers: 13
2519
Consumers: ", style=filled];
26-
8 [color=grey, label="Block: S:1__O:64
27-
Producers: 11
20+
6 [color=grey, label="Block: S:1__O:0
21+
Producers: 16
2822
Consumers: ", style=filled];
29-
9 [color=grey, label="Block: S:1__O:0
30-
Producers: 14
23+
7 [color=red, label="Block: S:64__O:0
24+
Producers: 16
3125
Consumers: ", style=filled];
32-
10 [color=grey, label="Block: S:64__O:0
33-
Producers: 14
26+
8 [color=red, label="Block: S:1__O:64
27+
Producers: 16
3428
Consumers: ", style=filled];
35-
11 [color=green, label="Block: S:1__O:64
36-
Producers: 14
37-
Consumers: 29", style=filled];
38-
12 [color=red, label="Block: S:1__O:0
39-
Producers: 29
29+
9 [color=red, label="Block: S:1__O:0
30+
Producers: 22
4031
Consumers: ", style=filled];
41-
13 [color=green, label="Block: S:1__O:0
42-
Producers: 33
43-
Consumers: 35", style=filled];
44-
14 [color=red, label="Block: S:1__O:0
45-
Producers: 35
32+
10 [color=green, label="Block: S:1__O:0
33+
Producers: 26
34+
Consumers: 28", style=filled];
35+
11 [color=red, label="Block: S:1__O:0
36+
Producers: 28
4637
Consumers: ", style=filled];
47-
15 [color=red, label="Block: S:1__O:0
48-
Producers: 39
38+
12 [color=red, label="Block: S:1__O:0
39+
Producers: 32
4940
Consumers: ", style=filled];
5041
0 -> 1;
51-
0 -> 4;
52-
1 -> 2;
53-
2 -> 3;
54-
4 -> 5;
42+
0 -> 2;
43+
3 -> 4;
44+
3 -> 5;
5545
6 -> 7;
5646
6 -> 8;
57-
7 -> 2;
58-
8 -> 5;
59-
9 -> 10;
60-
9 -> 11;
61-
10 -> 3;
6247
}

tests/torch/data/reference_graphs/pruning_groups/CLIP.dot

+25-40
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,47 @@ strict digraph {
22
0 [color=grey, label="Block: S:1__O:0
33
Producers: 10
44
Consumers: ", style=filled];
5-
1 [color=grey, label="Block: S:2__O:0
5+
1 [color=red, label="Block: S:2__O:0
66
Producers: 10
77
Consumers: ", style=filled];
8-
2 [color=grey, label="Block: S:2__O:0
9-
Producers: 10,12
10-
Consumers: ", style=filled];
11-
3 [color=green, label="Block: S:2__O:0
12-
Producers: 10,12,16
13-
Consumers: 34", style=filled];
14-
4 [color=grey, label="Block: S:1__O:2
8+
2 [color=red, label="Block: S:1__O:2
159
Producers: 10
1610
Consumers: ", style=filled];
17-
5 [color=green, label="Block: S:1__O:2
18-
Producers: 10,12
19-
Consumers: 27", style=filled];
11+
3 [color=grey, label="Block: S:1__O:0
12+
Producers: 11
13+
Consumers: ", style=filled];
14+
4 [color=red, label="Block: S:2__O:0
15+
Producers: 11
16+
Consumers: ", style=filled];
17+
5 [color=red, label="Block: S:1__O:2
18+
Producers: 11
19+
Consumers: ", style=filled];
2020
6 [color=grey, label="Block: S:1__O:0
2121
Producers: 12
2222
Consumers: ", style=filled];
23-
7 [color=grey, label="Block: S:2__O:0
23+
7 [color=red, label="Block: S:2__O:0
2424
Producers: 12
2525
Consumers: ", style=filled];
26-
8 [color=grey, label="Block: S:1__O:2
26+
8 [color=red, label="Block: S:1__O:2
2727
Producers: 12
2828
Consumers: ", style=filled];
29-
9 [color=grey, label="Block: S:1__O:0
30-
Producers: 16
29+
9 [color=red, label="Block: S:1__O:0
30+
Producers: 22
3131
Consumers: ", style=filled];
32-
10 [color=grey, label="Block: S:2__O:0
33-
Producers: 16
32+
10 [color=grey, label="Block: S:1__O:0
33+
Producers: 25
3434
Consumers: ", style=filled];
35-
11 [color=green, label="Block: S:1__O:2
36-
Producers: 16
37-
Consumers: 34", style=filled];
35+
11 [color=green, label="Block: S:1__O:0
36+
Producers: 25
37+
Consumers: 29", style=filled];
3838
12 [color=red, label="Block: S:1__O:0
39-
Producers: 34
40-
Consumers: ", style=filled];
41-
13 [color=grey, label="Block: S:1__O:0
42-
Producers: 37
43-
Consumers: ", style=filled];
44-
14 [color=green, label="Block: S:1__O:0
45-
Producers: 37
46-
Consumers: 41", style=filled];
47-
15 [color=red, label="Block: S:1__O:0
48-
Producers: 41
39+
Producers: 29
4940
Consumers: ", style=filled];
5041
0 -> 1;
51-
0 -> 4;
52-
1 -> 2;
53-
2 -> 3;
54-
4 -> 5;
42+
0 -> 2;
43+
3 -> 4;
44+
3 -> 5;
5545
6 -> 7;
5646
6 -> 8;
57-
7 -> 2;
58-
8 -> 5;
59-
9 -> 10;
60-
9 -> 11;
61-
10 -> 3;
62-
13 -> 14;
47+
10 -> 11;
6348
}
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,47 @@
11
strict digraph {
22
0 [color=grey, label="Block: S:1__O:0
3-
Producers: 7
3+
Producers: 8
44
Consumers: ", style=filled];
5-
1 [color=grey, label="Block: S:2__O:0
6-
Producers: 7
5+
1 [color=red, label="Block: S:2__O:0
6+
Producers: 8
77
Consumers: ", style=filled];
8-
2 [color=grey, label="Block: S:2__O:0
9-
Producers: 7,10
8+
2 [color=red, label="Block: S:1__O:2
9+
Producers: 8
1010
Consumers: ", style=filled];
11-
3 [color=green, label="Block: S:2__O:0
12-
Producers: 7,10,13
13-
Consumers: 29", style=filled];
14-
4 [color=grey, label="Block: S:1__O:2
15-
Producers: 7
11+
3 [color=grey, label="Block: S:1__O:0
12+
Producers: 11
1613
Consumers: ", style=filled];
17-
5 [color=green, label="Block: S:1__O:2
18-
Producers: 7,10
19-
Consumers: 18", style=filled];
20-
6 [color=grey, label="Block: S:1__O:0
21-
Producers: 10
14+
4 [color=red, label="Block: S:2__O:0
15+
Producers: 11
2216
Consumers: ", style=filled];
23-
7 [color=grey, label="Block: S:2__O:0
24-
Producers: 10
17+
5 [color=red, label="Block: S:1__O:2
18+
Producers: 11
2519
Consumers: ", style=filled];
26-
8 [color=grey, label="Block: S:1__O:2
27-
Producers: 10
20+
6 [color=grey, label="Block: S:1__O:0
21+
Producers: 14
2822
Consumers: ", style=filled];
29-
9 [color=grey, label="Block: S:1__O:0
30-
Producers: 13
23+
7 [color=red, label="Block: S:2__O:0
24+
Producers: 14
3125
Consumers: ", style=filled];
32-
10 [color=grey, label="Block: S:2__O:0
33-
Producers: 13
26+
8 [color=red, label="Block: S:1__O:2
27+
Producers: 14
3428
Consumers: ", style=filled];
35-
11 [color=green, label="Block: S:1__O:2
36-
Producers: 13
37-
Consumers: 29", style=filled];
38-
12 [color=red, label="Block: S:1__O:0
39-
Producers: 29
29+
9 [color=red, label="Block: S:1__O:0
30+
Producers: 21
4031
Consumers: ", style=filled];
41-
13 [color=green, label="Block: S:1__O:0
42-
Producers: 32
43-
Consumers: 34", style=filled];
44-
14 [color=red, label="Block: S:1__O:0
45-
Producers: 34
32+
10 [color=green, label="Block: S:1__O:0
33+
Producers: 24
34+
Consumers: 26", style=filled];
35+
11 [color=red, label="Block: S:1__O:0
36+
Producers: 26
4637
Consumers: ", style=filled];
47-
15 [color=red, label="Block: S:1__O:0
48-
Producers: 39
38+
12 [color=red, label="Block: S:1__O:0
39+
Producers: 31
4940
Consumers: ", style=filled];
5041
0 -> 1;
51-
0 -> 4;
52-
1 -> 2;
53-
2 -> 3;
54-
4 -> 5;
42+
0 -> 2;
43+
3 -> 4;
44+
3 -> 5;
5545
6 -> 7;
5646
6 -> 8;
57-
7 -> 2;
58-
8 -> 5;
59-
9 -> 10;
60-
9 -> 11;
61-
10 -> 3;
6247
}

0 commit comments

Comments
 (0)