Skip to content

Fix FlopsProfiler crash when dp_world_size is None under sequence parallelism#8122

Open
vineethsaivs wants to merge 1 commit into
deepspeedai:masterfrom
vineethsaivs:fix/flops-profiler-dp-world-size-none
Open

Fix FlopsProfiler crash when dp_world_size is None under sequence parallelism#8122
vineethsaivs wants to merge 1 commit into
deepspeedai:masterfrom
vineethsaivs:fix/flops-profiler-dp-world-size-none

Conversation

@vineethsaivs

Copy link
Copy Markdown

Problem

When Ulysses sequence parallelism is enabled, the DeepSpeed engine reports dp_world_size as None (groups._get_data_parallel_world_size() returns None for a sequence-parallel mpu, because the data-parallel replication is folded into the sequence-data-parallel group).

FlopsProfiler.print_model_profile() formats that value with '{:<8}', and '{:<8}'.format(None) raises:

TypeError: unsupported format string passed to NoneType.__format__

so the profiler crashes on every profile step once sequence parallelism is on. This matches the traceback in #7483.

Fix

When dp_world_size is None, report seq_dp_world_size instead (the engine always sets it, and under sequence parallelism it is the effective data-parallel replication). The normal (non-sequence-parallel) path is unchanged.

Test

Added test_print_model_profile_with_none_dp_world_size in tests/unit/profiling/flops_profiler/test_flops_profiler.py. It drives print_model_profile with an engine whose dp_world_size is None. It fails on master with the NoneType.__format__ TypeError and passes with this change, asserting the sequence-data-parallel world size is shown for "data parallel size".

Fixes #7483

…allelism

When Ulysses sequence parallelism is enabled the DeepSpeed engine reports
dp_world_size as None, since the data-parallel replication is folded into the
sequence-data-parallel group. print_model_profile formatted that value with
'{:<8}', which raised 'unsupported format string passed to NoneType.__format__'
and crashed the profiler at every step. Report the sequence-data-parallel world
size when dp_world_size is None.

Fixes deepspeedai#7483

Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] FlopsProfiler will hit error when sequence parallel enabled

1 participant