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

Add a condition for checking labels #14211

Merged
merged 1 commit into from
Oct 29, 2021

Conversation

hrxorxm
Copy link
Contributor

@hrxorxm hrxorxm commented Oct 29, 2021

What does this PR do?

This PR adds stability by checking whether it has labels before returning it in prediction_step of Seq2SeqTrainer
There is a similar condition in prediction_step of Trainer

if has_labels:
    labels = nested_detach(tuple(inputs.get(name) for name in self.label_names))
    if len(labels) == 1:
        labels = labels[0]
else:
    labels = None

Before submitting

Who can review?

For trainer : @sgugger

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

LGTM, thanks a lot for fixing!

@sgugger sgugger merged commit e823d81 into huggingface:master Oct 29, 2021
Albertobegue pushed a commit to Albertobegue/transformers that referenced this pull request Jan 27, 2022
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.

None yet

2 participants