Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic in how metric states referencing is handled in MetricCollection #2990

Merged
merged 17 commits into from
Mar 13, 2025

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Mar 5, 2025

What does this PR do?

Fixes #2896

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?
PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃


📚 Documentation preview 📚: https://torchmetrics--2990.org.readthedocs.build/en/2990/

Sorry, something went wrong.

@SkafteNicki SkafteNicki added the bug / fix Something isn't working label Mar 5, 2025
@SkafteNicki SkafteNicki added this to the v1.6.x milestone Mar 5, 2025
@SkafteNicki SkafteNicki self-assigned this Mar 5, 2025
@Borda
Copy link
Member

Borda commented Mar 10, 2025

@SkafteNicki please check:

FAILED unittests/bases/test_collections.py::TestComputeGroups::test_check_compute_groups_items_and_values[keys-metrics1-expected1-preds1-target1] - AssertionError: assert False
 +  where False = _allclose_recursive(tensor([0, 0, 0]), tensor([4, 2, 2]))
 +    where tensor([0, 0, 0]) = getattr(MulticlassAccuracy(), 'tp')
 +    and   tensor([4, 2, 2]) = getattr(MulticlassAccuracy(), 'tp')
FAILED unittests/bases/test_collections.py::TestComputeGroups::test_check_compute_groups_items_and_values[keys-metrics2-expected2-preds2-target2] - AssertionError: assert False
 +  where False = _allclose_recursive(tensor([0, 0, 0]), tensor([4, 2, 2]))
 +    where tensor([0, 0, 0]) = getattr(MulticlassRecall(), 'tp')
 +    and   tensor([4, 2, 2]) = getattr(MulticlassRecall(), 'tp')
FAILED unittests/bases/test_collections.py::TestComputeGroups::test_check_compute_groups_items_and_values[keys-metrics4-expected4-preds4-target4] - AssertionError: assert False
 +  where False = _allclose_recursive(tensor([[0, 0, 0],\n        [0, 0, 0],\n        [0, 0, 0]]), tensor([[4, 2, 6],\n        [4, 2, 8],\n        [4, 8, 2]]))
 +    where tensor([[0, 0, 0],\n        [0, 0, 0],\n        [0, 0, 0]]) = getattr(MulticlassCohenKappa(), 'confmat')
 +    and   tensor([[4, 2, 6],\n        [4, 2, 8],\n        [4, 8, 2]]) = getattr(MulticlassCohenKappa(), 'confmat')
FAILED unittests/bases/test_collections.py::TestComputeGroups::test_check_compute_groups_items_and_values[keys-metrics5-expected5-preds5-target5] - AssertionError: assert False
 +  where False = _allclose_recursive(tensor([0, 0, 0]), tensor([4, 2, 2]))
 +    where tensor([0, 0, 0]) = getattr(MulticlassAccuracy(), 'tp')
 +    and   tensor([4, 2, 2]) = getattr(MulticlassAccuracy(), 'tp')

Copy link

codecov bot commented Mar 12, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 70%. Comparing base (0423a2c) to head (0e2e69d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #2990    +/-   ##
=======================================
+ Coverage      69%     70%    +1%     
=======================================
  Files         352     352            
  Lines       19663   19663            
=======================================
+ Hits        13540   13698   +158     
+ Misses       6123    5965   -158     
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify mergify bot added the ready label Mar 12, 2025
@SkafteNicki SkafteNicki enabled auto-merge (squash) March 13, 2025 07:54
@mergify mergify bot removed the has conflicts label Mar 13, 2025
@SkafteNicki SkafteNicki merged commit cafd7cf into master Mar 13, 2025
60 checks passed
@SkafteNicki SkafteNicki deleted the bugfix/collection_state_refs branch March 13, 2025 10:31
Borda pushed a commit that referenced this pull request Mar 13, 2025
…ction` (#2990)

* fix logic + tests

* changelog

* fix tests

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit cafd7cf)
Borda pushed a commit that referenced this pull request Mar 13, 2025
…ction` (#2990)

* fix logic + tests

* changelog

* fix tests

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit cafd7cf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MetricCollection compute groups never re-established after copy
3 participants