Skip to content

Conversation

@breznak
Copy link

@breznak breznak commented Nov 28, 2025

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses.
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Summary

simplify our wrapper method configure_torch_metrics(), delegate the init and error handling to the torchmetrics.MetricCollection().

The problem was that our if-elif handling got obsolete wrt the MetricCollection capabilities.

Fixed: now we support eg. Dict[str, Metric].

simplify our wrapper method configure_torch_metrics(), delegate the init
and error handling to the torchmetrics.MetricCollection().

The problem was that our if-elif handling got obsolete wrt the
MetricCollection capabilities.

Fixed: now we support eg. Dict[str, Metric].
@breznak breznak requested a review from dennisbader as a code owner November 28, 2025 01:57
if torch_metrics is None:
torch_metrics = torchmetrics.MetricCollection([])
elif isinstance(torch_metrics, torchmetrics.Metric):
torch_metrics = torchmetrics.MetricCollection([torch_metrics])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MetricsCollection() handles all the supported cases, and tells us correctly if it does not handle some format.

breznak added 2 commits November 29, 2025 14:06
now raises ValueError, not AttributeError
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.52%. Comparing base (7d5f73e) to head (d547ad2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2958      +/-   ##
==========================================
- Coverage   95.59%   95.52%   -0.07%     
==========================================
  Files         152      152              
  Lines       16300    16296       -4     
==========================================
- Hits        15582    15567      -15     
- Misses        718      729      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant