openvino.save_model#

openvino.save_model(model: ov::Model, output_model: object, compress_to_fp16: bool = True) None#

Save model into IR files (xml and bin). Floating point weights are compressed to FP16 by default. This method saves a model to IR applying all necessary transformations that usually applied in model conversion flow provided by mo tool. Paricularly, floatting point weights are compressed to FP16, debug information in model nodes are cleaned up, etc.

Parameters:
  • model (openvino.runtime.Model) – model which will be converted to IR representation

  • output_model (Union[str, bytes, pathlib.Path]) – path to output model file

  • compress_to_fp16 (bool) – whether to compress floating point weights to FP16 (default: True). The parameter is ignored for pre-optimized models.

Examples:

model = convert_model('your_model.onnx')
save_model(model, './model.xml')