From aa0c6adaf96ac7944ecf4dfb1dd5c6243c2f195f Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 2 Oct 2023 19:24:42 +0400 Subject: [PATCH] Fixed issue --- optimum/exporters/openvino/convert.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/optimum/exporters/openvino/convert.py b/optimum/exporters/openvino/convert.py index b1597e60d2..22cbeb68b9 100644 --- a/optimum/exporters/openvino/convert.py +++ b/optimum/exporters/openvino/convert.py @@ -194,11 +194,12 @@ def export_pytorch_via_onnx( ) torch.onnx.export = orig_torch_onnx_export ov_model = convert_model(str(onnx_output)) + load_in_8bit = False if model_kwargs is None else model_kwargs.get("load_in_8bit", False) _save_model( ov_model, output.parent / OV_XML_FILE_NAME if output.suffix != ".xml" else output, compress_to_fp16=False, - load_in_8bit=model_kwargs.get("load_in_8bit", False), + load_in_8bit=load_in_8bit, ) return input_names, output_names, True @@ -326,7 +327,8 @@ def ts_patched_forward(*args, **kwargs): inp_tensor.get_node().set_partial_shape(static_shape) inp_tensor.get_node().set_element_type(get_element_type(inp_data.cpu().numpy().dtype)) ov_model.validate_nodes_and_infer_types() - _save_model(ov_model, output, compress_to_fp16=False, load_in_8bit=model_kwargs.get("load_in_8bit", False)) + load_in_8bit = False if model_kwargs is None else model_kwargs.get("load_in_8bit", False) + _save_model(ov_model, output, compress_to_fp16=False, load_in_8bit=load_in_8bit) clear_class_registry() del model gc.collect()