Skip to content

fix: avoid ZeroDivisionError in compute_elastic_config return_microbatch path#8162

Open
Solaris-star wants to merge 1 commit into
deepspeedai:masterfrom
Solaris-star:fix/8156-elastic-return-microbatch-zerodiv
Open

fix: avoid ZeroDivisionError in compute_elastic_config return_microbatch path#8162
Solaris-star wants to merge 1 commit into
deepspeedai:masterfrom
Solaris-star:fix/8156-elastic-return-microbatch-zerodiv

Conversation

@Solaris-star

Copy link
Copy Markdown

Description

compute_elastic_config(..., return_microbatch=True) on elasticity version 0.1 (and any non-0.2 version) divided by the default world_size=0 and raised a bare ZeroDivisionError. Version 0.2 already has a dedicated microbatch path that does not need this division.

Changes

  • For non-0.2 versions, require a positive world_size argument or numeric WORLD_SIZE env before selecting a microbatch.
  • Raise ElasticityConfigError with a clear message instead of ZeroDivisionError.
  • Validate world_size against valid_gpus before dividing.
  • Add unit tests for the missing-world_size error path and the successful path with world_size=64.

Related issue

Fixes #8156

Tests

  • Added test_return_microbatch_requires_world_size_v01
  • Added test_return_microbatch_with_world_size_v01
  • Offline pure-logic verification of the fixed branch (full DeepSpeed suite needs torch/GPU CI)

…tch path

For elasticity versions other than 0.2, return_microbatch=True with the
default world_size=0 divided by zero. Require a positive world_size (or
WORLD_SIZE) and raise ElasticityConfigError instead.

Fixes deepspeedai#8156

Signed-off-by: Solaris-star <820622658@qq.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.

compute_elastic_config raises bare ZeroDivisionError for return_microbatch=True on non-0.2 elasticity versions without explicit world_size

1 participant