Skip to content

Commit 7edffc8

Browse files
committed
Style
1 parent 0410b42 commit 7edffc8

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

optimum/intel/__init__.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363
"OVWeightQuantizationConfig",
6464
]
6565
else:
66-
_import_structure["openvino"].extend(["OVConfig", "OVQuantizer", "OVTrainer", "OVTrainingArguments", "OVWeightQuantizationConfig"])
66+
_import_structure["openvino"].extend(
67+
["OVConfig", "OVQuantizer", "OVTrainer", "OVTrainingArguments", "OVWeightQuantizationConfig"]
68+
)
6769

6870
try:
6971
if not (is_openvino_available() and is_diffusers_available()):
@@ -172,7 +174,13 @@
172174
if not (is_openvino_available() and is_nncf_available()):
173175
raise OptionalDependencyNotAvailable()
174176
except OptionalDependencyNotAvailable:
175-
from .utils.dummy_openvino_and_nncf_objects import OVConfig, OVQuantizer, OVTrainer, OVTrainingArguments, OVWeightQuantizationConfig
177+
from .utils.dummy_openvino_and_nncf_objects import (
178+
OVConfig,
179+
OVQuantizer,
180+
OVTrainer,
181+
OVTrainingArguments,
182+
OVWeightQuantizationConfig,
183+
)
176184
else:
177185
from .openvino import OVConfig, OVQuantizer, OVTrainer, OVTrainingArguments, OVWeightQuantizationConfig
178186

optimum/intel/openvino/quantization.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -279,16 +279,18 @@ def _quantize_ovcausallm(
279279
**kwargs,
280280
):
281281
if self.model.stateful and not weights_only:
282-
raise Exception("Full quantizaiton for stateful OVModelForCausalLM is currently broken. Possbile options:\n"
283-
"1. Quantize AutoModelForCausalLM\n"
284-
"2. Use weight only quantization\n"
285-
"3. Use stateful=False to export stateless model")
286-
282+
raise Exception(
283+
"Full quantizaiton for stateful OVModelForCausalLM is currently broken. Possbile options:\n"
284+
"1. Quantize AutoModelForCausalLM\n"
285+
"2. Use weight only quantization\n"
286+
"3. Use stateful=False to export stateless model"
287+
)
288+
287289
save_directory = Path(save_directory)
288290
save_directory.mkdir(parents=True, exist_ok=True)
289291

290292
if weights_only:
291-
if quantization_config is None:
293+
if quantization_config is None:
292294
# Use default 8-bit compression
293295
self.model.model = nncf.compress_weights(self.model.model)
294296
else:

tests/openvino/test_quantization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class OVQuantizerTest(unittest.TestCase):
6666
# TODO : add models, enable OVModelForCausalLM.
6767
SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS = (
6868
(OVModelForSequenceClassification, "hf-internal-testing/tiny-random-bert", 32, 35),
69-
#(OVModelForCausalLM, "hf-internal-testing/tiny-random-gpt2", 41, 23),
69+
# (OVModelForCausalLM, "hf-internal-testing/tiny-random-gpt2", 41, 23),
7070
)
7171

7272
@parameterized.expand(SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS)

0 commit comments

Comments
 (0)