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

make num_items_in_batch optional in compute_loss_func #36426

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SunMarc
Copy link
Member

@SunMarc SunMarc commented Feb 26, 2025

What does this PR do?

Fixes #36331

This PR fixes the breaking change that we have with custom loss function as we introduced num_items_in_batch.

@SunMarc SunMarc changed the title make it optional make num_items_in_batch optional in compute_loss_func Feb 26, 2025
@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

@ruidazeng ruidazeng left a comment

Choose a reason for hiding this comment

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

Is there a way to make it work even if we don't specify compute_loss_func.

@techkang
Copy link
Contributor

I think the num_items_in_batch argument should be mandatory because leaving it as None when compute_loss_func is set could trigger the GA loss bug. A better way to fix issue #36331 might be to add more specific documentation for compute_loss_func.

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.

TypeError: CustomTrainer.compute_loss() got an unexpected keyword argument 'num_items_in_batch'
4 participants