set all fusedrope inputs to bf16#140
Merged
Merged
Conversation
|
@skaulintel , what is the reason to hard cast data type to bf16? what about --bf16 is not used in the model's command? |
+1 |
Author
|
@mandy-li In order to calculate RoPE in bf16, we have to cast all inputs to bf16. From my analysis, I see that when we pass --bf16 True to the training script when running llama-7b (examples/language-modeling/run_lora_clm.py) I see the following dtypes passed to apply_customized_rope q: torch.float32, k: torch.bfloat16, cos: torch.float32, sin: torch.float32 Since query is passed in as float32, we won't compute that in bf16. but for the key states we will compute them in bf16. @kbinias please review. |
libinta
approved these changes
Apr 10, 2024
sushildubey171
pushed a commit
that referenced
this pull request
Apr 12, 2024
astachowiczhabana
pushed a commit
that referenced
this pull request
Apr 19, 2024
astachowiczhabana
pushed a commit
that referenced
this pull request
Apr 22, 2024
astachowiczhabana
pushed a commit
that referenced
this pull request
Apr 24, 2024
astachowiczhabana
pushed a commit
that referenced
this pull request
Apr 24, 2024
astachowiczhabana
added a commit
that referenced
this pull request
Mar 5, 2025
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.
When passing --bf16 to train/inference cmd, ensure all input tensors are cast to bf16.
Change fused rope input type to bf16 for llama models