dumps OnnxDiscrepancyCheck result on disc so they can be picked up later and gathered for a dashboard#2503
dumps OnnxDiscrepancyCheck result on disc so they can be picked up later and gathered for a dashboard#2503xadupre wants to merge 19 commits into
Conversation
|
@copilot test\cli\test_cli.py:173: in test_workflow_run_command_with_test_override |
Fixed in the latest commit. The test was patching |
|
@copilot test/cli/test_cli.py:177: in test_workflow_run_command_with_test_override |
…n discrepancy_check pass config
Fixed in the latest commit. The test assertion was missing |
|
@copilot test/cli/test_cli.py:244: in test_workflow_run_command_with_test_reuses_test_output_dir |
…_test_reuses_test_output_dir
Fixed in the latest commit — added |
There was a problem hiding this comment.
Pull request overview
This PR extends the OnnxDiscrepancyCheck pass and CLI --test flow to persist discrepancy metrics to disk so they can be inspected later (e.g., by a dashboard). It also updates CLI tests to reflect the injected discrepancy-check configuration and to avoid serializing mock objects.
Changes:
- Add
report_output_dirsupport and JSON result dumping forOnnxDiscrepancyCheck, plus propagation of results viamodel_attributes. - In
--testmode, injectmax_mae=0.1andreport_output_dir=<output_dir>into the discrepancy-check pass config and persist results into the run output folder. - Fix CLI unit tests to align with the new injected config and to avoid attempting to
json.dumpsaMagicMock.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
test/cli/test_cli.py |
Updates CLI tests for --test to include new discrepancy-check config fields and avoid serializing mocked workflow output. |
olive/passes/onnx/discrepancy_check.py |
Adds report directory support, writes results JSON, stores results into model_attributes, and adds optional reference-model artifact export. |
olive/cli/run.py |
Persists discrepancy-check results to the CLI output directory after a --test run. |
olive/cli/base.py |
Injects discrepancy-check pass config during --test and adds a helper to save discrepancy results from workflow output into the CLI output directory. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot replace print(f"Adding OnnxDiscrepancyCheck pass with reference_model_path={reference_model_path}") and print(f"OnnxDiscrepancyCheck results saved to {report_path}") by logging |
Done — both |
Describe your changes
The pass OnnxDiscrepancyCheck is used to gather metrics on canary models. They need to be dumped to let the user see them in detail, the user can be a dashboard as well.
When
--testis active,add_discrepancy_check_passnow injectsmax_mae: 0.1andreport_output_dir(set to the run config'soutput_dir) into the discrepancy check pass configuration alongsidereference_model_path. Bothreport_output_dirand the CLIsave_discrepancy_check_resultshelper normalize file paths to their parent directory to avoid writing artifacts under a path that looks like a file.Fixed test regressions in
test_workflow_run_command_with_test_overrideandtest_workflow_run_command_with_test_reuses_test_output_dir:mock_run.return_value = Nonesosave_discrepancy_check_resultsexits early at its null-guard check instead of attempting to serialize aMagicMockviajson.dumps.assert_called_once_withexpectation to includemax_maeandreport_output_dirin the expected discrepancy check pass config.OnnxDiscrepancyChecknow raises aValueErrorafter persisting the report when any configured threshold is exceeded (numeric metric thresholds or generation token sequence minimum), failing the run instead of silently succeeding. This restores the documented "the pass fails if any configured threshold is exceeded" behavior for--testruns.Replaced
printstatements inolive/cli/base.pywithlogger.debugcalls to follow the project's logging conventions.Checklist before requesting a review
lintrunner -a(Optional) Issue link