[Llama2] Add disabling TP behavior#728
Merged
younesbelkada merged 3 commits intohuggingface:mainfrom Jul 19, 2023
Merged
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
pacman100
approved these changes
Jul 19, 2023
Contributor
pacman100
left a comment
There was a problem hiding this comment.
Thank you @younesbelkada for the quick fix, LGTM!
BenjaminBossan
approved these changes
Jul 19, 2023
Member
BenjaminBossan
left a comment
There was a problem hiding this comment.
It sounds reasonable to me that for fine-tuning, TP is disabled, especially if it is just simulated. I wonder if this should be documented somewhere, since, as you mentioned, it can lead to small numerical differences. Perhaps a comment above these new lines of code?
Contributor
Author
Sure yes, will add this ! |
Guy-Bilitski
pushed a commit
to Guy-Bilitski/peft
that referenced
this pull request
May 13, 2025
* add disabling TP behavior * add comments * adapt from new changes of transformers PR
cyyever
pushed a commit
to cyyever/peft
that referenced
this pull request
Sep 4, 2025
* update to `prepare_model_for_kbit_training` from deprecated `prepare_model_for_int8_training` and add `use_gradient_checkpointing=args.gradient_checkpointing` to automatically follow the gradient checkpointing choice is also the workaround for huggingface#694 * workaround for gradient checkpointing issue calling model.gradient_checkpointing_enable() twice causes issues this workaround calls it in prepare_model_for_kbit_training and then changes the arg to false to make sure it isn't called again in huggingface trainer inner loop also changes stack_llama_2 sft trainer to use correct device map for ddp training so that you can test this issue
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.
Fixes #726
This PR is on par with huggingface/transformers#24906
Currently the TP paradigm that is supported by transformers, technically is not really a real Tensor Parallelism paradigm but rather a simulation of TP by manually splitting the layers into chunks and concatenating the results.
The motivation of that implementation is to mimic the TP paradigm that was used during pre-training of these models, as slicing weight tensors and input leads to slight numerical differences: pytorch/pytorch#76232
I would argue that this might be not that important for training as the model will be fine-tuned, thus the weights of the model will be adapted accordingly.
cc @pacman100 @BenjaminBossan
I propose to properly support TP in the future once this is properly implemented, currently the TP that is in place is more a patch to match the logits of the original implementation