Thanks to visit codestin.com
Credit goes to github.com

Skip to content

another way to use shift_labels#38533

Closed
ydshieh wants to merge 1 commit into
mainfrom
better_loss
Closed

another way to use shift_labels#38533
ydshieh wants to merge 1 commit into
mainfrom
better_loss

Conversation

@ydshieh

@ydshieh ydshieh commented Jun 2, 2025

Copy link
Copy Markdown
Collaborator

What does this PR do?

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@ydshieh ydshieh requested a review from ArthurZucker June 3, 2025 08:05
Comment on lines -573 to -575
loss = None
if labels is not None:
loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We still need to change in many modeling files, but at least it's more clean than in #37993

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@ArthurZucker if you are happy with this, I will apply the changes to other files.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

its alright but it creates an indirection! TBH i'd rather we check labels is not None or "shit_labels" in kwargs

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks and sorry for the back and forth

Comment on lines -573 to -575
loss = None
if labels is not None:
loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

its alright but it creates an indirection! TBH i'd rather we check labels is not None or "shit_labels" in kwargs

@ydshieh

ydshieh commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator Author

No worry

I will hold on as you mentioned there is a WIP PR #39047

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.

3 participants