Skip to content

Improve error message for class_weight with PyTorch DataLoaders #21414

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

Merged
merged 2 commits into from
Jul 7, 2025

Conversation

sonali-kumari1
Copy link
Contributor

@sonali-kumari1 sonali-kumari1 commented Jun 24, 2025

Updated the error message for class_weight with PyTorch DataLoaders to suggest two solutions: modifying the __getitem__ method or using a custom training loop. Included a link to the user guide for the custom training loop.

Fixes #21355

@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.72%. Comparing base (3d6022a) to head (7f44384).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #21414   +/-   ##
=======================================
  Coverage   82.72%   82.72%           
=======================================
  Files         565      565           
  Lines       55222    55222           
  Branches     8609     8609           
=======================================
  Hits        45683    45683           
  Misses       7428     7428           
  Partials     2111     2111           
Flag Coverage Δ
keras 82.53% <ø> (ø)
keras-jax 63.33% <ø> (ø)
keras-numpy 58.53% <ø> (+<0.01%) ⬆️
keras-openvino 33.79% <ø> (ø)
keras-tensorflow 63.74% <ø> (ø)
keras-torch 63.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Jul 7, 2025
@fchollet fchollet merged commit 22ab5a3 into keras-team:master Jul 7, 2025
9 checks passed
@google-ml-butler google-ml-butler bot removed awaiting review ready to pull Ready to be merged into the codebase kokoro:force-run labels Jul 7, 2025
@sonali-kumari1 sonali-kumari1 deleted the dataAdaptersTest branch July 8, 2025 04:20
Mohamed-Ashraf273 pushed a commit to Mohamed-Ashraf273/keras that referenced this pull request Jul 8, 2025
…s-team#21414)

* Improve error message for class_weight with PyTorch DataLoaders

* Improve error message for class_weight with PyTorch DataLoaders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keras-team-review-pending Pending review by a Keras team member. size:XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation: better info about class_weight and/or DataAdapters
4 participants