Skip to content

Add Mobius exporter support to olive optimize - #2658

Open
Tommaso Adani (tadani3) wants to merge 4 commits into
mainfrom
tommasoadani/mobius_discrepancy_integration
Open

Add Mobius exporter support to olive optimize#2658
Tommaso Adani (tadani3) wants to merge 4 commits into
mainfrom
tommasoadani/mobius_discrepancy_integration

Conversation

@tadani3

Copy link
Copy Markdown
Contributor

Describe your changes

Adds Mobius exporter support to olive optimize.

  • Adds mobius to the supported --exporter values while preserving model_builder as the default.
  • Schedules MobiusBuilder as the sole initial ONNX exporter.
  • Restricts Mobius export precision to fp32, fp16, and bf16.
  • Prevents incompatible peephole, FP16 conversion, and OpenVINO conversion passes from being scheduled.
  • Makes Mobius export the saved reference model during --test, ensuring discrepancy checks use identical weights.
  • Resolves the test model to a local path and clears remote revision handling.
  • Adds mobius-onnx to MCP dependency discovery.
  • Documents Mobius requirements and supported precisions.

Testing

  • Optimize CLI tests: 5 passed.
  • MobiusBuilder tests: 38 passed, 1 optional integration test skipped.
  • MCP package resolver tests: 2 passed.
  • Lintrunner passed for all changed files.

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a.
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

Release notes

olive optimize now supports --exporter mobius. Mobius export requires
mobius-onnx and supports fp32, fp16, and bf16. In test mode, the
Mobius-produced ONNX model is exported from the same saved Hugging Face model
used as the discrepancy-check reference.

(Optional) Issue link

N/A

Copilot AI lite review requested due to automatic review settings September 10, 2026 22:33

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.

🟡 Changes recommended

Three moderate issues remain involving MCP precision validation, OpenVINO pass scheduling, and Mobius splitting.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds mobius exporter support to olive optimize, including precision handling, test-model reuse, MCP dependency resolution, documentation, and tests.

Changes:

  • Adds Mobius exporter scheduling and validation.
  • Reuses saved test-model weights for discrepancy checks.
  • Updates MCP package discovery and documentation.
File summaries
File Description
test/passes/onnx/test_mobius_model_builder.py Tests Mobius test-model handling.
test/mcp/test_packages.py Tests MCP dependency resolution.
test/cli/test_cli.py Tests Mobius CLI scheduling and validation.
olive/passes/onnx/mobius_model_builder.py Uses saved local test models for export.
olive/cli/optimize.py Adds Mobius exporter configuration and pass scheduling.
mcp/src/olive_mcp/tools.py Documents Mobius options.
mcp/src/olive_mcp/packages.py Adds mobius-onnx dependency resolution.
docs/source/reference/python_api.md Documents Mobius requirements and supported precisions.
Review details

Suppressed comments (2)

mcp/src/olive_mcp/packages.py:130

  • MCP preflight validation does not enforce Mobius's precision restriction: optimize(exporter="mobius", precision="int4") passes _validate_params, causes this dependency setup (and even adds datasets), and only fails later when the Olive CLI rejects the precision. Mirror the fp32/fp16/bf16 check in the MCP validation so invalid jobs are rejected before creating a virtual environment.
        elif exporter == "mobius":
            extra_packages.append("mobius-onnx")

olive/cli/optimize.py:515

  • The new Mobius path leaves --num_split/--memory combinations enabled. Those options schedule CaptureSplitInfo before this exporter and SplitModel afterward; SplitModel reads split_assignments only from ONNX metadata, while MobiusBuilder only carries the assignments in the returned handler attributes and does not annotate the exported graph, so the workflow reaches No split assignments found in the model metadata. Reject splitting with Mobius or propagate the assignments into the exported ONNX metadata.
        return self.is_hf_model and self.args.exporter == "mobius"
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread olive/cli/optimize.py
Comment on lines +513 to +515
def _enable_mobius_builder_pass(self) -> bool:
"""Return true if condition to add MobiusBuilder pass is met."""
return self.is_hf_model and self.args.exporter == "mobius"
@xiaoyu-work

Copy link
Copy Markdown
Member

duplicated as #2640?

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