Skip to content

Commit f1681b0

Browse files
committed
replied to comments
1 parent 472bf44 commit f1681b0

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

optimum/intel/openvino/quantization.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from nncf.torch.initialization import PTInitializingDataLoader
3131
from openvino._offline_transformations import compress_quantize_weights_transformation
3232
from openvino.runtime import Core, Tensor
33+
from torch.utils._pytree import tree_map
3334
from torch.utils.data import DataLoader, RandomSampler
3435
from transformers import DataCollator, PreTrainedModel, default_data_collator
3536
from transformers.pytorch_utils import Conv1D
@@ -350,9 +351,7 @@ def _quantize_ovcausallm(
350351
self.model.model,
351352
quantization_dataset,
352353
model_type=nncf.ModelType.TRANSFORMER if not kwargs.get("model_type") else kwargs.get("model_type"),
353-
fast_bias_correction=(
354-
True if not kwargs.get("fast_bias_correction") else kwargs.get("fast_bias_correction")
355-
),
354+
fast_bias_correction=kwargs.get("fast_bias_correction", True),
356355
**kwargs,
357356
)
358357
self.model.model = quantized_model
@@ -410,8 +409,6 @@ def _quantize_torchmodel(
410409
stateful = ensure_stateful_is_available() and ensure_export_task_support_stateful(task)
411410

412411
if weights_only:
413-
from torch.utils._pytree import tree_map
414-
415412
if stateful:
416413
# patch model before weight compression
417414
model = patch_model_with_bettertransformer(model)

tests/openvino/test_quantization.py

-5
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,6 @@ class OVWeightCompressionTest(unittest.TestCase):
174174

175175
@parameterized.expand(SUPPORTED_ARCHITECTURES_WITH_EXPECTED_8BIT_COMPRESSED_MATMULS)
176176
def test_automodel_weight_compression(self, model_cls, model_name, expected_pt_int8, expected_ov_int8):
177-
import nncf
178-
179-
if nncf.__version__ == "2.8.0":
180-
self.skipTest("https://github.com/openvinotoolkit/nncf/issues/2432")
181-
182177
task = model_cls.export_feature
183178

184179
with tempfile.TemporaryDirectory() as tmp_dir:

0 commit comments

Comments
 (0)