Skip to content

Skip hpopt reporting when no result was provided - #3082

Open
Con-Benksl wants to merge 1 commit into
speechbrain:developfrom
Con-Benksl:fix/hpopt-unreported-result
Open

Con-Benksl wants to merge 1 commit into
speechbrain:developfrom
Con-Benksl:fix/hpopt-unreported-result

Conversation

@Con-Benksl

Copy link
Copy Markdown

What does this PR do?

Fixes #2358.

Exiting a hyperparameter-optimization context without calling report_result() reports the initial {"objective": 0.0} placeholder. This raises KeyError with a custom objective key, including evaluation-only runs, or emits a result that was never measured with the default key.

Initialize the pending result to None, which the existing exit guard already handles. Explicitly reported results, including zero, still go through the selected reporter or generic fallback.

Validation:

  • New regression cases cover no result with custom/default objective keys and hpopt enabled/disabled. Before the fix: 4 failed, 5 passed (2 KeyErrors and 2 unwanted zero reports).
  • pytest tests/unittests/test_hpopt.py --doctest-modules speechbrain/utils/hpopt.py -q: 18 passed. This also checks explicit zero results, last-result selection and context cleanup using the real generic reporter.
  • pre-commit run -a and git diff --check passed.

No model downloads or training runs were needed. The full suite and a live Oríon experiment were not run. No new dependencies or API changes.

Implemented and tested with OpenAI Codex, with independent read-only review by another Codex agent.

Before submitting
  • Read the contributor guideline.
  • This PR does one thing.
  • Documentation checked; the existing API/docstrings remain applicable.
  • Added necessary regression tests.
  • Verified new and related existing tests locally (scope above).
  • Listed breaking changes: none.
  • Followed project code style and conventions.

PR review

Reviewer checklist
  • Is this pull request ready for review?
  • Check that all items from Before submitting are resolved.
  • Make sure the title is self-explanatory and the description concisely explains the PR.
  • Add labels and milestones (and optionally projects) to classify the PR.
  • Confirm compatibility requirements.
  • Review the self-review checklist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant