Skip to content

Conversation

@leejianwoo-collab
Copy link
Contributor

fix: avoid IndexError in BF16_Optimizer.destroy() when using DummyOptim

Short-circuit BF16_Optimizer.destroy() if using_real_optimizer is False.
When initialized with optimizer=None (DummyOptim), bf16_groups remains empty, causing an IndexError when accessing it in destroy().

Resolves #7752

@tohtana
Copy link
Collaborator

tohtana commented Jan 6, 2026

Hi @leejianwoo-collab, thank you for your contribution!
Can you fix format?

@leejianwoo-collab
Copy link
Contributor Author

ok @tohtana

@sfc-gh-truwase
Copy link
Collaborator

@leejianwoo-collab thanks for the PR. For context, DummyOptim was a temporary hack to enable ZeRO-Inference but it somehow outlived its useful. So the long-term solution is to eliminate DummyOptim. However, your solution is fine for now.

@tohtana tohtana enabled auto-merge (squash) January 7, 2026 08:11
@tohtana tohtana merged commit b35d9eb into deepspeedai:master Jan 7, 2026
9 checks passed
leejianwoo-collab added a commit to leejianwoo-collab/DeepSpeed_woo that referenced this pull request Jan 7, 2026
…im (deepspeedai#7763)

fix: avoid IndexError in BF16_Optimizer.destroy() when using DummyOptim

Short-circuit BF16_Optimizer.destroy() if using_real_optimizer is False.
When initialized with optimizer=None (DummyOptim), bf16_groups remains
empty, causing an IndexError when accessing it in destroy().

Resolves deepspeedai#7752

Signed-off-by: leejianwoo-collab <leejianwoo@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] IndexError in BF16_Optimizer.destroy() when optimizer=None (DummyOptim)

3 participants