Skip to content

Conversation

maxxgx
Copy link
Contributor

@maxxgx maxxgx commented Oct 10, 2025

  • move to cpu when device is mps

📝 Description

Bug: on Mac, the optimal threshold index is out of range.

Torchmetrics returns NaN values when computing the f1 score with device=mps.

Solution: use CPU instead of mps

@ashwinvaidya17 thanks for the suggestion.

✨ Changes

Select what type of change your PR is:

  • 🚀 New feature (non-breaking change which adds functionality)
  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🔄 Refactor (non-breaking change which refactors the code base)
  • ⚡ Performance improvements
  • 🎨 Style changes (code style/formatting)
  • 🧪 Tests (adding/modifying tests)
  • 📚 Documentation update
  • 📦 Build system changes
  • 🚧 CI/CD configuration
  • 🔧 Chore (general maintenance)
  • 🔒 Security update
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)

✅ Checklist

Before you submit your pull request, please make sure you have completed the following steps:

  • 📚 I have made the necessary updates to the documentation (if applicable).
  • 🧪 I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).
  • 🏷️ My PR title follows conventional commit format.

For more information about code review checklists, see the Code Review Checklist.

* align shape of precision/recall to thresholds

Signed-off-by: Ma, Xiangxiang <xiangxiang.ma@intel.com>

* move to cpu when device is mps

Signed-off-by: Ma, Xiangxiang <xiangxiang.ma@intel.com>

---------

Signed-off-by: Ma, Xiangxiang <xiangxiang.ma@intel.com>
@maxxgx maxxgx requested review from ashwinvaidya17 and Copilot and removed request for Copilot October 10, 2025 13:09
@maxxgx maxxgx changed the title 🐛 fix(metrics): disable mps for torch metrics (#3018) 🐛 fix(metrics): disable mps for torch metrics Oct 10, 2025
@maxxgx maxxgx enabled auto-merge (squash) October 10, 2025 13:22
@maxxgx maxxgx disabled auto-merge October 10, 2025 13:22
@maxxgx maxxgx enabled auto-merge (squash) October 10, 2025 13:22
@maxxgx maxxgx merged commit 163f8bc into open-edge-platform:main Oct 10, 2025
14 checks passed
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.

2 participants