Skip to content

Commit

Permalink
Support NNCF 2.14 and OV 2024.5 (#997)
Browse files Browse the repository at this point in the history
* Tweak reference values

* Update requirements to OV 2024.5

* Update tokenizers condition in tests

* Fix condition

* Trigger Tests

* Trigger Tests
  • Loading branch information
nikita-savelyevv authored Nov 21, 2024
1 parent f755590 commit 595246d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

EXTRAS_REQUIRE = {
"nncf": ["nncf>=2.11.0"],
"openvino": ["nncf>=2.11.0", "openvino==2024.4.1.dev20240926", "openvino-tokenizers==2024.4.1.0.dev20240926"],
"openvino": ["nncf>=2.11.0", "openvino==2024.5.0", "openvino-tokenizers==2024.5.0"],
"neural-compressor": ["neural-compressor[pt]>3.0", "accelerate", "transformers<4.46"],
"ipex": ["intel-extension-for-pytorch", "transformers>=4.39,<4.45"],
"diffusers": ["diffusers"],
Expand Down
17 changes: 9 additions & 8 deletions tests/openvino/test_exporters_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from optimum.intel.utils.import_utils import (
compare_versions,
is_openvino_tokenizers_available,
is_openvino_version,
is_tokenizers_version,
is_transformers_version,
)
Expand Down Expand Up @@ -80,20 +81,20 @@ class OVCLIExportTestCase(unittest.TestCase):
if is_transformers_version(">=", "4.45"):
SUPPORTED_ARCHITECTURES.extend([("text-to-image", "stable-diffusion-3"), ("text-to-image", "flux")])
EXPECTED_NUMBER_OF_TOKENIZER_MODELS = {
"gpt2": 2 if is_tokenizers_version("<", "0.20") else 0,
"gpt2": 2 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 0,
"t5": 0, # no .model file in the repository
"albert": 0, # not supported yet
"distilbert": 1, # no detokenizer
"roberta": 2 if is_tokenizers_version("<", "0.20") else 0,
"roberta": 2 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 0,
"vit": 0, # no tokenizer for image model
"wav2vec2": 0, # no tokenizer
"bert": 1, # no detokenizer
"blenderbot": 2 if is_tokenizers_version("<", "0.20") else 0,
"stable-diffusion": 2 if is_tokenizers_version("<", "0.20") else 0,
"stable-diffusion-xl": 4 if is_tokenizers_version("<", "0.20") else 0,
"stable-diffusion-3": 6 if is_tokenizers_version("<", "0.20") else 2,
"flux": 4 if is_tokenizers_version("<", "0.20") else 0,
"llava": 2 if is_tokenizers_version("<", "0.20") else 0,
"blenderbot": 2 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 0,
"stable-diffusion": 2 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 0,
"stable-diffusion-xl": 4 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 0,
"stable-diffusion-3": 6 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 2,
"flux": 4 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 0,
"llava": 2 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 0,
}

SUPPORTED_SD_HYBRID_ARCHITECTURES = [
Expand Down
4 changes: 2 additions & 2 deletions tests/openvino/test_quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class OVWeightCompressionTest(unittest.TestCase):
sensitivity_metric="mean_activation_magnitude",
dataset=["one two, " * i for i in range(10)],
),
{"int4": 25, "int8": 14},
{"int4": 24, "int8": 16},
),
(
OVModelForCausalLM,
Expand Down Expand Up @@ -915,7 +915,7 @@ def preprocess_function(examples, tokenizer):


class OVTrainerTest(unittest.TestCase):
SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS = (("albert", 64, 39),)
SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS = (("albert", 63, 39),)

@parameterized.expand(SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS)
@unittest.skipIf(
Expand Down

0 comments on commit 595246d

Please sign in to comment.