Skip to content

Reject ambiguous combined evaluation result keys - #849

Open
FOWEPJF255 wants to merge 1 commit into
huggingface:mainfrom
FOWEPJF255:codex/fix-combined-result-key-collisions
Open

FOWEPJF255 wants to merge 1 commit into
huggingface:mainfrom
FOWEPJF255:codex/fix-combined-result-key-collisions

Conversation

@FOWEPJF255

Copy link
Copy Markdown

Fixes #834.

combine() can silently discard a score when the existing prefix rules produce a key already present in the final result. This affects both generated-prefix/raw-key collisions and forced-prefix combinations such as a_b + c and a + b_c.

Compute the existing final key before insertion and raise a descriptive ValueError on collision. Collision-free names and values keep their current behavior. This deliberately reports ambiguous output instead of introducing an automatic-renaming policy. The combine docstring documents the exception.

The regression tests use real local evaluation modules and combine().compute(). They cover default and forced prefixes in both input orders, numbered duplicate module names, and a collision-free control. This implementation starts from official upstream main; related #835 is closed and unmerged.

Validation on Windows/Python 3.12.10, Datasets 2.21.0, NumPy 1.26.4 and PyArrow 17.0.0:

  • The five collision regressions fail on unchanged source; all six new cases pass with this change.
  • python -m pytest tests/test_metric.py -k 'not modules_from_string' -q: 28 passed, 2 skipped for optional Torch/TensorFlow, 2 Hub-loading tests deselected.
  • Black checks all 183 files; repository isort check and the changed test file's Flake8 check pass. git diff --check passes.
  • Repository Flake8 reports six pre-existing diagnostics in module.py, utils/file_utils.py and utils/logging.py. Running the same checker against those exact files from unchanged main reproduces all six. No unrelated lint edits are included.

I attempted the contribution guide's self-assignment step on #834, but GitHub denied the assignment operation for this account. The reproduction and work plan are recorded in the issue.

AI assistance: OpenAI Codex assisted with investigation, implementation, tests and this description. The checks above were executed locally.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

combine silently overwrites scores when final result keys collide

1 participant