Add ORTGenAI backend option to benchmark CLI#2396
Add ORTGenAI backend option to benchmark CLI#2396GopalakrishnanN wants to merge 2 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an explicit backend selector to the olive benchmark CLI so users can choose between ORT and ORTGenAI evaluation for ONNX inputs, with validation and CLI tests to cover the new behavior.
Changes:
- Add
--backend {auto,ort,ortgenai}option to the benchmark CLI. - Wire
--backendinto the generated benchmark config viaevaluators.evaluator.model_class. - Add validation and tests for backend selection and invalid backend usage on non-ONNX inputs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
olive/cli/benchmark.py |
Adds --backend argument, validates usage, and maps it to LMEvaluator.model_class in the generated config. |
test/cli/test_cli.py |
Adds CLI tests for ortgenai backend config wiring and invalid backend usage on non-ONNX models. |
| if self.args.backend != "auto" and input_model_config["type"].lower() != "onnxmodel": | ||
| raise ValueError("--backend is only supported for ONNX input models.") |
There was a problem hiding this comment.
--backend validation happens after get_input_model_config(self.args), which can call hf_repo_exists (network) when the model path does not exist. For invalid uses like --backend ortgenai -m <hf-model-id>, consider short-circuiting before get_input_model_config by checking whether model_name_or_path points to an existing local ONNX file or directory (or previous-command output that resolves to OnnxModel), so the command fails fast and works better offline.
|
@GopalakrishnanN please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
GopalakrishnanN
left a comment
There was a problem hiding this comment.
Accepted Copilot's suggestion to create output directory in a temp path.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Context
The benchmark command currently defaults to the ONNX Runtime lm-eval model path. Olive already has ORTGenAI lm-eval support in the evaluator layer, but benchmark CLI had no way to select it.
This PR exposes that capability through benchmark CLI while preserving existing defaults.
What This Changes
--backendwith choices:auto(default)ortortgenaimodel_classwhen backend is notauto.--backend autois used (or omitted).--backendis only accepted for ONNX input models.Why This Approach
User-Facing Behavior
Examples:
olive benchmark -m <model> --tasks arc_easyolive benchmark -m <onnx_model> --tasks arc_easy --backend ortolive benchmark -m <onnx_model> --tasks arc_easy --backend ortgenaiIf
--backendis provided for non-ONNX inputs, benchmark now raises a clear error.Tests Added/Updated
--backend ortgenaiand writes evaluatormodel_class=ortgenai.ValueError.Validation
pip install -e .python -m olive --helppython -m olive benchmark --helppython -m pytest test/cli/test_cli.py -k benchmark_command -q