Skip to content

Commit

Permalink
[shardformer] pp+tp+zero1
Browse files Browse the repository at this point in the history
  • Loading branch information
flybird11111 committed Aug 28, 2023
1 parent 039cb24 commit e011bf3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions tests/test_shardformer/test_model/test_shard_vit.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ def run_vit_test(test_config):
'precision': 'fp32',
'initial_scale': 1,
},
{
'tp_size': 2,
'pp_size': 2,
'num_microbatches': 2,
'enable_all_optimization': False,
'use_lazy_init': False,
'precision': 'fp32',
'initial_scale': 1,
},
])
def run_vit_3d_test(test_config):
sub_model_zoo = model_zoo.get_sub_registry('transformers_vit')
Expand Down
13 changes: 11 additions & 2 deletions tests/test_shardformer/test_model/test_shard_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def check_forward_backward(model_fn, data_gen_fn, output_transform_fn, loss_fn,
# check last hidden state & loss
if stage_manager is None or stage_manager.is_last_stage():
if test_config['precision'] == 'fp32':
atol, rtol = 2e-4, 2e-4
atol, rtol = 5e-4, 5e-4
else:
atol, rtol = 5e-3, 5e-3

Expand Down Expand Up @@ -77,7 +77,7 @@ def check_forward_backward(model_fn, data_gen_fn, output_transform_fn, loss_fn,

# check weights and gradients
if test_config['precision'] == 'fp32':
atol, rtol = 2e-4, 2e-4
atol, rtol = 5e-4, 5e-4
else:
atol, rtol = 5e-3, 5e-3

Expand Down Expand Up @@ -166,6 +166,15 @@ def run_whisper_test(test_config):
'precision': 'fp32',
'initial_scale': 1,
},
{
'tp_size': 2,
'pp_size': 2,
'num_microbatches': 2,
'enable_all_optimization': False,
'use_lazy_init': False,
'precision': 'fp32',
'initial_scale': 1,
},
])
def run_whisper_3d_test(test_config):
sub_model_zoo = model_zoo.get_sub_registry('transformers_whisper')
Expand Down

0 comments on commit e011bf3

Please sign in to comment.