Repository navigation
Parallelize ONNX external-data saves by default - #508
Merged
Merged
Conversation
Expose a configurable max_workers setting through ModelPackage.save and the build CLIs, defaulting to eight workers while allowing one worker for serial saves. Detect support in onnx_ir at runtime so version 1.0 continues to save without the new keyword. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 52b46a71-2bb5-42d0-9ed0-8a6821de9b0f Signed-off-by: Justin Chu <[email protected]>
Performance Comparison
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a max_workers knob to Mobius’ save/export pipeline to enable parallelized ONNX external-data writes by default (when supported by the installed onnx_ir), and wires the setting through the CLI.
Changes:
- Added
max_workerstoModelPackage.save(default8) and forwarded it toonnx_ir.savevia signature-based feature detection foronnx_ir1.0 compatibility. - Exposed
--max-workersonmobius buildandmobius build-gguf, including validation for non-positive values. - Added unit tests covering the default, override plumbing, and error behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/cli_test.py | Adds CLI-level tests for default/override/error handling of --max-workers. |
| src/mobius/_model_package.py | Introduces max_workers to ModelPackage.save and conditionally forwards it to onnx_ir.save. |
| src/mobius/_model_package_test.py | Adds unit tests verifying forwarding behavior for supported/unsupported onnx_ir.save signatures and input validation. |
| src/mobius/main.py | Adds --max-workers arguments to CLI commands, validates input, and forwards to ModelPackage.save. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
max_workerstoModelPackage.save, defaulting to 8--max-workersonmobius buildandmobius build-gguf, with1restoring serial savesonnx_ir.savewhen supported while retainingonnx_ir1.0 compatibility through signature-based feature detectionValidation
python -m pytest src/mobius/_model_package_test.py tests/cli_test.py -q --tb=short(75 passed)lintrunner f --output oneline --all-files