-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Enable hpz based on secondary tensor presence #4906
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
Merged
Merged
Conversation
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
samadejacobs
approved these changes
Jan 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good job @HeyangQin
tjruwase
reviewed
Jan 8, 2024
…/DeepSpeed into HeyangQin/mixz_hpz_fix
Manually running nightly tests here: https://github.com/microsoft/DeepSpeed/actions/runs/7658819103 |
mrwyattii
reviewed
Jan 25, 2024
mrwyattii
approved these changes
Jan 25, 2024
Is hpz safe to use now? |
mauryaavinash95
pushed a commit
to mauryaavinash95/DeepSpeed
that referenced
this pull request
Feb 17, 2024
Previously we use a series of forward/backward flags to control if hpz should be enabled on certain allgather call. This PR simplifies this by enabling hpz only when its secondary tensor exists (and invalidating its secondary tensor whenever master weights changes). This should: 1. Prevent potential out-of-sync issue compared with our currently way of overwriting secondary tensor 2. Improve throughput because now hpz will be enabled in a lot of different scenarios including i) activation checkpointing, ii) gradient accumulation, iii)`torch.no_grad` context, iv) `model.eval()` mode, v)LoRA frozen weights, vi) gradient overflow This is to fix deepspeedai#4851 Convergence test: - llama-2-7b random weights, using https://github.com/microsoft/DeepSpeedExamples/blob/master/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/training_scripts/llama2/run_llama2_7b.sh. > zero-3 Baseline: Evaluating perplexity, Epoch 4/4: ppl: 5.151907920837402, loss: 1.6393671035766602 > hpz with this PR: ppl: 5.081737518310547, loss: 1.6256532669067383 - llama-2-7b pretrained weights with lora, using https://github.com/microsoft/DeepSpeedExamples/blob/master/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/training_scripts/llama2/run_llama2_7b_lora.sh. > zero-3 Baseline: Evaluating perplexity, Epoch 4/4: ppl: 1.8326854705810547, loss: 0.6057823896408081 > hpz with this PR: ppl: 1.8326854705810547, loss: 0.6057823896408081 Performance test on 32 V100, still using https://github.com/microsoft/DeepSpeedExamples/blob/master/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/training_scripts/llama2/run_llama2_7b.sh. - gradient accumulation step = 8 > master branch with hpz: SamplesPerSec=17.567813158654847 > this patch with hpz: SamplesPerSec=24.121657876029225 - lora > master branch with hpz: SamplesPerSec=33.88883430864484 > this patch with hpz: SamplesPerSec=43.39463460004735 --------- Co-authored-by: Michael Wyatt <[email protected]>
rraminen
pushed a commit
to ROCm/DeepSpeed
that referenced
this pull request
May 9, 2024
Previously we use a series of forward/backward flags to control if hpz should be enabled on certain allgather call. This PR simplifies this by enabling hpz only when its secondary tensor exists (and invalidating its secondary tensor whenever master weights changes). This should: 1. Prevent potential out-of-sync issue compared with our currently way of overwriting secondary tensor 2. Improve throughput because now hpz will be enabled in a lot of different scenarios including i) activation checkpointing, ii) gradient accumulation, iii)`torch.no_grad` context, iv) `model.eval()` mode, v)LoRA frozen weights, vi) gradient overflow This is to fix deepspeedai#4851 Convergence test: - llama-2-7b random weights, using https://github.com/microsoft/DeepSpeedExamples/blob/master/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/training_scripts/llama2/run_llama2_7b.sh. > zero-3 Baseline: Evaluating perplexity, Epoch 4/4: ppl: 5.151907920837402, loss: 1.6393671035766602 > hpz with this PR: ppl: 5.081737518310547, loss: 1.6256532669067383 - llama-2-7b pretrained weights with lora, using https://github.com/microsoft/DeepSpeedExamples/blob/master/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/training_scripts/llama2/run_llama2_7b_lora.sh. > zero-3 Baseline: Evaluating perplexity, Epoch 4/4: ppl: 1.8326854705810547, loss: 0.6057823896408081 > hpz with this PR: ppl: 1.8326854705810547, loss: 0.6057823896408081 Performance test on 32 V100, still using https://github.com/microsoft/DeepSpeedExamples/blob/master/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/training_scripts/llama2/run_llama2_7b.sh. - gradient accumulation step = 8 > master branch with hpz: SamplesPerSec=17.567813158654847 > this patch with hpz: SamplesPerSec=24.121657876029225 - lora > master branch with hpz: SamplesPerSec=33.88883430864484 > this patch with hpz: SamplesPerSec=43.39463460004735 --------- Co-authored-by: Michael Wyatt <[email protected]>
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.
Previously we use a series of forward/backward flags to control if hpz should be enabled on certain allgather call. This PR simplifies this by enabling hpz only when its secondary tensor exists (and invalidating its secondary tensor whenever master weights changes). This should:
torch.no_grad
context, iv)model.eval()
mode, v)LoRA frozen weights, vi) gradient overflowThis is to fix #4851
Convergence test:
Performance test on 32 V100, still using https://github.com/microsoft/DeepSpeedExamples/blob/master/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/training_scripts/llama2/run_llama2_7b.sh.