Skip to content

Parallelize ONNX external-data saves by default - #508

Merged
justinchuby merged 1 commit into
mainfrom
justinchuby-parallel-save-workers
Aug 17, 2026
Merged

justinchuby merged 1 commit into
mainfrom
justinchuby-parallel-save-workers

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

  • add max_workers to ModelPackage.save, defaulting to 8
  • expose --max-workers on mobius build and mobius build-gguf, with 1 restoring serial saves
  • forward the setting to onnx_ir.save when supported while retaining onnx_ir 1.0 compatibility through signature-based feature detection
  • reject non-positive worker counts and document the behavior

Validation

  • python -m pytest src/mobius/_model_package_test.py tests/cli_test.py -q --tb=short (75 passed)
  • lintrunner f --output oneline --all-files

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]>
@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 17, 2026 17:55
@github-actions

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 781bbe8 → 3bce9d6

Model Sub-model Changes Status

No architecture changes detected. ✅


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@github-actions

Copy link
Copy Markdown

Performance Comparison

Comparing 781bbe8 → 3bce9d6

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 60 60 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 105 105 +0.0% ⚪
gpt2 model_size_bytes 388 KB 388 KB +0.0% ⚪
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 264 264 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 126 126 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 428 428 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 166 166 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_workers to ModelPackage.save (default 8) and forwarded it to onnx_ir.save via signature-based feature detection for onnx_ir 1.0 compatibility.
  • Exposed --max-workers on mobius build and mobius 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.

Comment thread src/mobius/_model_package.py Resolved
@justinchuby
justinchuby merged commit fd69dc6 into main Aug 17, 2026
21 of 22 checks passed
@justinchuby
justinchuby deleted the justinchuby-parallel-save-workers branch August 17, 2026 18:02
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.

2 participants