Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving external data for large ONNX models #255

Closed
wants to merge 15 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions optimum/onnxruntime/modeling_ort.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ def _save_pretrained(self, save_directory: Union[str, Path], file_name: Optional
"""
model_file_name = file_name if file_name is not None else ONNX_WEIGHTS_NAME

src_path = self.model_save_dir.joinpath(self.latest_model_name)
dst_path = Path(save_directory).joinpath(model_file_name)
shutil.copyfile(src_path, dst_path)
src_path = self.model_save_dir
dst_path = Path(save_directory)

# TODO: only copy the onnx model and external data
shutil.copytree(src_path, dst_path, dirs_exist_ok=True)

@classmethod
def _from_pretrained(
Expand Down