in optimum/amd/ryzenai/modeling.py [0:0]
def _save_pretrained(self, save_directory: Union[str, Path]):
"""
Saves a model and its configuration file to a directory, so that it can be re-loaded using the
[`~optimum.onnxruntime.modeling_ort.RyzenAIModel.from_pretrained`] class method. It will always save the
file under model_save_dir/latest_model_name.
Args:
save_directory (`Union[str, Path]`):
Directory where to save the model file.
"""
src_paths = [self.model_path]
dst_paths = [Path(save_directory) / self.model_path.name]
# add external data paths in case of large models
src_paths, dst_paths = _get_external_data_paths(src_paths, dst_paths)
if self.vaip_config:
src_paths.append(self.vaip_config)
dst_paths.append(Path(save_directory) / self.vaip_config.name)
for src_path, dst_path in zip(src_paths, dst_paths):
shutil.copyfile(src_path, dst_path)