Conversation
📝 WalkthroughWalkthroughAdds a None-check in the translation metrics evaluation module. If the generation value is None during update, it is replaced with an empty string before being appended to the predictions list. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
nemo_skills/evaluation/metrics/translation_metrics.py (1)
61-71: None-handling is correct; just confirm empty-string vs skipping behaviorUsing an empty string when
generation is Noneis a reasonable way to keeppreds/gtsaligned and avoid sacrebleu type errors; it will treat “no output” as a worst-case hypothesis, which is often what you want for metrics. If that’s the intended semantics, this looks good as-is.If instead you’d prefer to ignore examples with missing generations (so they don’t affect BLEU at all), an alternative would be:
for pred in predictions: src_lang = pred["source_language"] tgt_lang = pred["target_language"] generation = pred["generation"] ground_truth = pred["translation"] - if generation is None: - generation = "" - - self.translation_dict[f"{src_lang}->{tgt_lang}"]["preds"].append(generation) - self.translation_dict[f"{src_lang}->{tgt_lang}"]["gts"].append(ground_truth) + if generation is not None: + self.translation_dict[f"{src_lang}->{tgt_lang}"]["preds"].append(generation) + self.translation_dict[f"{src_lang}->{tgt_lang}"]["gts"].append(ground_truth)From a correctness standpoint, your current change is fine; it just encodes a particular policy about how missing outputs should influence metrics.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
nemo_skills/evaluation/metrics/translation_metrics.py(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: pre-commit
- GitHub Check: unit-tests
|
Hi @Froxyy-dev looks good to me! Please update with |
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Mateusz Winiarek <mwiniarek@nvidia.com>
Signed-off-by: Mateusz Winiarek <mwiniarek@nvidia.com>
84b847c to
4b7fb63
Compare
|
Hi @gwarmstrong, I've signed the DCO! |
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Mateusz Winiarek <mwiniarek@nvidia.com> Co-authored-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Mateusz Winiarek <mwiniarek@nvidia.com> Co-authored-by: George Armstrong <georgea@nvidia.com> Signed-off-by: wasiahmad <wasiahmad@ucla.edu>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Mateusz Winiarek <mwiniarek@nvidia.com> Co-authored-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Cheng-Ping Hsieh <chsieh@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Mateusz Winiarek <mwiniarek@nvidia.com> Co-authored-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Mateusz Winiarek <mwiniarek@nvidia.com> Co-authored-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Mateusz Winiarek <mwiniarek@nvidia.com> Co-authored-by: George Armstrong <georgea@nvidia.com> Signed-off-by: dgitman <dgitman@nvidia.com>
Summary by CodeRabbit
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.