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

Backward compatibility fix for the Conversation class #27176

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

Rocketknight1
Copy link
Member

Improve our handling of the old past_user_inputs property a bit, and revert a hack in the tests because it now works properly. Should fix all the tests that were red!

cc @ydshieh

@Rocketknight1 Rocketknight1 requested a review from ydshieh October 31, 2023 13:44
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 31, 2023

The documentation is not available anymore as the PR was closed or merged.

Comment on lines +172 to 175
if self.messages[-1]["role"] != "user" or self._num_processed_user_inputs == len(self._user_messages):
return self._user_messages

return self._user_messages[:-1]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we have a bit of comments about why this conditions and their output values?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean hard to understand why self._user_messages when self.messages[-1]["role"] != "user"

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a comment!

@Rocketknight1 Rocketknight1 merged commit 05f2290 into main Oct 31, 2023
@Rocketknight1 Rocketknight1 deleted the fix_conversational_tests branch October 31, 2023 15:12
EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 19, 2023
)

* Backward compatibility fix for the Conversation class

* Explain what's going on in the conditional
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