Skip to content

fix: delete stale external data sidecar before save_onnx overwrites it#320

Merged
xieofxie merged 2 commits into
mainfrom
hualxie/fix_quantize
Apr 13, 2026
Merged

fix: delete stale external data sidecar before save_onnx overwrites it#320
xieofxie merged 2 commits into
mainfrom
hualxie/fix_quantize

Conversation

@xieofxie
Copy link
Copy Markdown
Contributor

Summary

  • quantize_onnx calls ORT's quantize() (Step 3) which writes <output>.onnx.data, then calls save_onnx (Step 8) which tries to write the same sidecar again
  • onnx.save_model has no overwrite option and raises FileExistsError: External data file exists in <location>
  • Fix: save_onnx now deletes the existing .data sidecar before writing, so re-saving over an ORT-generated file works cleanly

…rites it

ORT quantize() writes the .data sidecar, then save_onnx tries to write
the same file again and hits onnx's FileExistsError. Delete the sidecar
before saving so the overwrite succeeds cleanly.
@xieofxie xieofxie requested a review from a team as a code owner April 13, 2026 06:49
@xieofxie xieofxie changed the title fix(quant): delete stale external data sidecar before save_onnx overwrites it fix: delete stale external data sidecar before save_onnx overwrites it Apr 13, 2026
@xieofxie
Copy link
Copy Markdown
Contributor Author

Found when trying quantize

@xieofxie xieofxie enabled auto-merge (squash) April 13, 2026 07:33
@xieofxie xieofxie merged commit cd65430 into main Apr 13, 2026
8 checks passed
@xieofxie xieofxie deleted the hualxie/fix_quantize branch April 13, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants