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

FIX: New bloom changes breaking prompt learning #1969

Conversation

BenjaminBossan
Copy link
Member

@BenjaminBossan BenjaminBossan commented Jul 29, 2024

Bloom had two dimensions of the attention layer transposed (compared to all other transformers models), which was fixed by:

huggingface/transformers#31445

Therefore, for future transformers versions, skip the special handling in PEFT.

There is also an issue that prompt injection did not take place when past_key_values was a Cache object that is empty. This should now hopefully work as expected.

For the time being, past_key_values is still being passed as a tuple of tensors, not sure if eventually this must be a Cache object. If yes, this will need fixing in a future PR. Same goes for the usage of get_seq_length() on Cache objects.

Note:
I tested this locally with transformers installed form main and bloom tests passed. PEFT CI only tests this nightly, not on PR.

Bloom had two dimensions of the attention layer transposed (compared to
all other transformers models), which was fixed by:

huggingface/transformers#31445

Therefore, for future transformers versions, skip the special handling
in PEFT.

There is also an issue that prompt injection did not take place when
past_key_values was a Cache object that is empty. This should now
hopefully work as expected.

Note: This needs a review from a transformers expert.
@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.

@BenjaminBossan
Copy link
Member Author

Would one of you @ArthurZucker or @gante be so kind to review this PR? Note that the code here is just unindented, so the actual diff is smaller than it seems.

Copy link
Member

@gante gante left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@BenjaminBossan BenjaminBossan merged commit 27833a2 into huggingface:main Jul 29, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the fix-prompt-learning-changes-bloom branch July 29, 2024 16:25
@gante
Copy link
Member

gante commented Jul 29, 2024

@BenjaminBossan

not sure if eventually this must be a Cache object.

I don't think it will, for the foreseeable future. We're out of bandwidth to convert all models 💔 A note: the cache class has a to_legacy_cache() method, PEFT can convert the Cache objects to the tuple format if needed

BenjaminBossan added a commit to BenjaminBossan/peft that referenced this pull request Aug 6, 2024
See huggingface#1969

The fix to the bloom architecture was not actually released in
transformers 4.43.3, which makes the version check invalid. Instead, now
checking an attribute on the BloomPreTrainedModel.
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