-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[shardformer] Pipeline/whisper #4456
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
CjhHa1
merged 11 commits into
hpcaitech:feature/shardformer
from
CjhHa1:pipeline/whisper
Aug 18, 2023
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d86aa76
add some base tests and policies
CjhHa1 73193b0
finish whisper base model
CjhHa1 656a4c0
add conditional generation
CjhHa1 5b8e507
finish basic tests
CjhHa1 3837871
whisper
CjhHa1 16cab76
finish whisper
CjhHa1 152e0fe
finish whisper
CjhHa1 1b17181
del useless whisper test
CjhHa1 99e9da3
fix
CjhHa1 e2961f3
add argmin to replace
CjhHa1 095d074
finish revision
CjhHa1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
39 changes: 39 additions & 0 deletions
39
tests/test_pipeline/test_pipeline_utils/test_t5_pipeline_utils.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| from colossalai.shardformer.policies.t5 import T5BasePolicy | ||
|
|
||
|
|
||
| def test_t5_pipeline_distribution(): | ||
| num_test_cases = 8 | ||
| test_dict = { | ||
| 'num_encoder_layers': [2, 1, 3, 2, 3, 2, 10, 5], | ||
| 'num_decoder_layers': [2, 8, 0, 2, 1, 5, 6, 22], | ||
| 'num_stages': [2, 2, 2, 4, 4, 4, 8, 8], | ||
| 'decoder_starting_stage': [1, 1, 2, 2, 3, 1, 5, 2] | ||
| } | ||
|
|
||
| for i in range(num_test_cases): | ||
| _, decoder_starting_stage = T5BasePolicy.distribute_t5_layers(test_dict['num_encoder_layers'][i], | ||
| test_dict['num_decoder_layers'][i], | ||
| test_dict['num_stages'][i]) | ||
| assert test_dict['decoder_starting_stage'][i] == decoder_starting_stage | ||
|
|
||
|
|
||
| def test_t5_pipeline_layers(): | ||
| num_test_cases = 4 | ||
| test_dict = { | ||
| 'num_encoder_layers': [2, 3, 2, 4], | ||
| 'num_decoder_layers': [2, 0, 2, 8], | ||
| 'num_stages': [2, 2, 4, 4], | ||
| 'layers_per_stage': [[[0, 2], [0, 2]], [[0, 1], [1, 3]], [[0, 1], [1, 2], [0, 1], [1, 2]], | ||
| [[0, 4], [0, 3], [3, 6], [6, 8]]] | ||
| } | ||
|
|
||
| for i in range(num_test_cases): | ||
| layers_per_stage, decoder_starting_stage = T5BasePolicy.distribute_t5_layers( | ||
| test_dict['num_encoder_layers'][i], test_dict['num_decoder_layers'][i], test_dict['num_stages'][i]) | ||
|
|
||
| for stage in range(test_dict['num_stages'][i]): | ||
| start_idx, end_idx = test_dict['layers_per_stage'][i][stage] | ||
| predicted_start, predicted_end = T5BasePolicy.get_t5_stage_index(layers_per_stage, stage, | ||
| decoder_starting_stage) | ||
| assert start_idx == predicted_start | ||
| assert end_idx == predicted_end |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.