Fix typo in WerMetric: use hyp_seqs instead of ref_seqs for hyp_seqs_list#1506
Conversation
…list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi @beckybyte! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
There was a problem hiding this comment.
Pull request overview
This PR fixes a logic bug in the WerMetric.update() implementation so that unit-level edit distance (UER) is computed against the hypothesis token sequences rather than accidentally comparing references against themselves.
Changes:
- Correct
hyp_seqs_listto be derived fromhyp_seqs(instead ofref_seqs) before computing edit distance.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thanks for the finding this bug and for the contribution! |
What does this PR do? Please describe:
Fix a typo in
WerMetric.update()wherehyp_seqs_listwas incorrectly assigned fromref_seqs.cpu().tolist()instead ofhyp_seqs.cpu().tolist(). This caused the unit-level edit distance to always compare reference sequences against themselves, making UER always 0 regardless of actual model output.Does your PR introduce any breaking changes? If yes, please list them:
No breaking changes.
Check list: