Skip to content

Conversation

clinty
Copy link
Contributor

@clinty clinty commented Sep 7, 2025

The forward methods of these classes accept kwargs, which leads Trainer's compute_loss() to incorrectly assume that they can handle num_items_per_batch, leading to training failure. This sets accepts_loss_kwargs to false explicitly to mitigate that assumption.

cc: @muellerzr @SunMarc

Copy link
Contributor

github-actions bot commented Sep 7, 2025

[For maintainers] Suggested jobs to run (before merge)

run-slow: convnext, convnextv2

Copy link
Contributor

@qubvel qubvel left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @clinty!

btw are there any other classification models affected?

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Thanks !

@SunMarc SunMarc merged commit 7b8d40e into huggingface:main Sep 8, 2025
17 checks passed
@clinty clinty deleted the convnext_accepts_loss_kwargs branch September 8, 2025 13:32
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/transformers that referenced this pull request Oct 2, 2025
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.

4 participants