[FA-2] Final fix for FA2 dtype#26846
Merged
younesbelkada merged 6 commits intohuggingface:mainfrom Oct 18, 2023
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
ArthurZucker
approved these changes
Oct 17, 2023
Collaborator
ArthurZucker
left a comment
There was a problem hiding this comment.
Thanks, think we can simplify a bit and remove the warning ?
Comment on lines
417
to
421
| logger.warning_once( | ||
| "The input hidden states seems to be silently casted in float32, this might be related to" | ||
| " the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in" | ||
| " float16." | ||
| f"The input hidden states seems to be silently casted in float32, this might be related to" | ||
| f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in" | ||
| f" {target_dtype}." | ||
| ) |
Collaborator
There was a problem hiding this comment.
I think we can remove this now no?
Contributor
Author
There was a problem hiding this comment.
Hmm I think we need to keep it to inform users about that
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
5 tasks
EduardoPach
pushed a commit
to EduardoPach/transformers
that referenced
this pull request
Nov 19, 2023
* final fix for FA2 dtype * try * oops * Update src/transformers/models/falcon/modeling_falcon.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * apply fix everywhere --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Replaces #26560
Fixes #26451
Proposes a simpler fix for dealing with FA-2 + PEFT + quantization fine-tuning where users usually cast all other modules (e.g. LayerNorms) in fp32 for training stability.
With #26761 being introduced, it is now much simpler to retrieve model's original dtype, note also that
self.config._pre_quantization_dtyperemains the single source of truth astois not supported for quantized modelscc @ArthurZucker @pacman100
Added also a nice test