.xbuilder.model_container¶
- class experimental_experiment.xbuilder.model_container.TorchModelContainer(*args, **kwargs)[source]¶
Overwrites
onnx.model_container.ModelContainer
to support torch tensors.- load(file_path: str, load_large_initializers: bool = True) TorchModelContainer [source]¶
Loads the large model.
- Parameters:
file_path – model file
load_large_initializers – loads the large initializers, if not done, the model is incomplete but it can be used to look into the model without executing it and method
_load_large_initializers()
can be used to load them later
- Returns:
self
- save(file_path: str, all_tensors_to_one_file: bool = True) ModelProto [source]¶
Saves the large model. The function returns a ModelProto, the current one if the model did not need any modification, a modified copy of it if it required changes such as giving file names to every external tensor.
- Parameters:
file_path – model file
all_tensors_to_one_file – saves all large tensors in one file or one file per lerge tensor
- Returns:
the saved ModelProto
- to_ir() onnxscript.ir.Model [source]¶
Conversion to
onnxscript.ir.Model
.