Add mobius to capture onnx graph cli#2471
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for using the MobiusBuilder pass from the capture-onnx-graph CLI path, enabling capturing ONNX graphs via mobius-ai (including support for multi-component multimodal models), and adds CLI test coverage for the new behavior.
Changes:
- Added
--use_mobius_builderflag toolive capture-onnx-graph. - Updated capture workflow config generation to route through a new
MobiusBuilderpass (b) and validate supported precisions/conflicting flags. - Added CLI unit tests covering MobiusBuilder selection, runtime setting, and invalid flag combinations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
olive/cli/capture_onnx.py |
Adds --use_mobius_builder and wires a new MobiusBuilder pass into the generated workflow config. |
test/cli/test_cli.py |
Adds CLI tests to validate MobiusBuilder config selection and input validation errors. |
| mb_group.add_argument( | ||
| "--use_mobius_builder", | ||
| action="store_true", | ||
| help=( | ||
| "Whether to use MobiusBuilder (mobius-ai) to capture ONNX model. " |
There was a problem hiding this comment.
Done in the latest commit. The three flags (--use_dynamo_exporter, --use_model_builder, --use_mobius_builder) are now registered in a single add_mutually_exclusive_group, so argparse rejects conflicting combinations immediately with a SystemExit(2) error message. The redundant runtime ValueError check has been removed, and the affected test has been updated to match the new behavior.
| if is_diffusers_model: | ||
| del config["passes"]["m"] | ||
| del config["passes"]["b"] | ||
| to_replace.extend( |
| @@ -197,8 +207,14 @@ def _get_run_config(self, tempdir: str) -> dict: | |||
| is_diffusers_model = input_model_config["type"].lower() == "diffusersmodel" | |||
|
|
|||
| # whether model is in fp16 or bf16 (currently not supported by CPU EP) | |||
There was a problem hiding this comment.
cpu supports f16 right?
Describe your changes
Add
--use_mobius_builderflag to thecapture-onnx-graphCLI command to support MobiusBuilder (mobius-ai) for capturing ONNX models, with multi-component multimodal model (VLM) support.The three mutually exclusive exporter flags (
--use_dynamo_exporter,--use_model_builder,--use_mobius_builder) are now enforced as mutually exclusive at the argparse layer viaadd_mutually_exclusive_group, providing immediate and consistent CLI feedback instead of a deferred runtime error.Checklist before requesting a review
lintrunner -a(Optional) Issue link