Skip to content

Commit f63e987

Browse files
committed
ruff happy
1 parent 3593e51 commit f63e987

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

optimum/exporters/openvino/model_patcher.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
import logging as log
1616

1717
from optimum.intel.utils.import_utils import (
18-
is_torch_version,
19-
is_transformers_version,
2018
_torch_version,
2119
_transformers_version,
20+
is_torch_version,
21+
is_transformers_version,
2222
)
2323

2424

optimum/intel/openvino/quantization.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,13 @@ def _quantize_torchmodel(
417417
model = patch_model_with_bettertransformer(model)
418418

419419
dummy_inputs = onnx_config.generate_dummy_inputs(framework="pt")
420-
device = self.model.device
420+
device = model.device
421421
dummy_inputs = tree_map(
422422
lambda value: value.to(device) if isinstance(value, torch.Tensor) else value, dummy_inputs
423423
)
424424
check_dummy_inputs_are_allowed(model, dummy_inputs)
425425

426-
nncf.compress_weights(self.model, dataset=nncf.Dataset([dummy_inputs]))
426+
nncf.compress_weights(model, dataset=nncf.Dataset([dummy_inputs]))
427427
else:
428428
if stateful:
429429
logger.warn(
@@ -443,10 +443,10 @@ def _quantize_torchmodel(
443443
quantization_config.add_input_info(model_inputs)
444444
nncf_config = NNCFConfig.from_dict(quantization_config.__dict__)
445445
nncf_config = register_default_init_args(nncf_config, calibration_dataloader)
446-
controller, compressed_model = create_compressed_model(
447-
self.model, nncf_config, wrap_inputs_fn=wrap_nncf_model_inputs_with_objwalk
446+
controller, model = create_compressed_model(
447+
model, nncf_config, wrap_inputs_fn=wrap_nncf_model_inputs_with_objwalk
448448
)
449-
compressed_model = controller.strip(do_copy=False)
449+
model = controller.strip(do_copy=False)
450450

451451
model_path = save_directory / (onnx_file_name if quantization_config.save_onnx_model else ov_file_name)
452452
onnx_path = save_directory / onnx_file_name

0 commit comments

Comments
 (0)