Fix boolean parsing for capture-onnx-graph options - #2647
Open
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
Open
Fix boolean parsing for capture-onnx-graph options#2647Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Sylvester Kaczmarek (sylvesterkaczmarek)
September 3, 2026 18:03
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change correctly addresses argparse boolean parsing semantics and is covered by targeted regression tests for valid and invalid inputs.
Pull request overview
This pull request fixes incorrect boolean parsing for the capture-onnx-graph CLI subcommand by replacing type=bool (which treats any non-empty string as True) with an explicit boolean parser, and adds regression tests to validate accepted/invalid values.
Changes:
- Added a
parse_boolargparse type that accepts common true/false string forms and rejects invalid values. - Updated
--exclude_embeds,--exclude_lm_head, and--enable_cuda_graphto usetype=parse_bool. - Added unit tests covering true/false variants and invalid input rejection.
File summaries
| File | Description |
|---|---|
olive/cli/capture_onnx.py |
Introduces parse_bool and wires it into capture-onnx-graph boolean options to ensure correct CLI parsing. |
test/cli/test_capture_onnx_args.py |
Adds regression tests verifying boolean parsing behavior and invalid value handling. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 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.
Describe your changes
Fixes boolean argument parsing for
capture-onnx-graph.The
--exclude_embeds,--exclude_lm_head, and--enable_cuda_graphoptions usedtype=bool. With argparse, values such asfalseare non-empty strings and therefore evaluate toTrue.The options now parse explicit
true/falsevalues correctly and reject invalid boolean input.Regression tests cover true, false, and invalid values.
Checklist before requesting a review