Skip to content

Add document section explaining autocast nesting#7883

Merged
tohtana merged 3 commits intodeepspeedai:masterfrom
tohtana:tohtana/doc-autocast-nesting
Mar 4, 2026
Merged

Add document section explaining autocast nesting#7883
tohtana merged 3 commits intodeepspeedai:masterfrom
tohtana:tohtana/doc-autocast-nesting

Conversation

@tohtana
Copy link
Collaborator

@tohtana tohtana commented Mar 4, 2026

Add a document section clarifying the behavior of nesting autocast and why/when we need it.

tohtana added 2 commits March 3, 2026 17:57
Explain why users may want to wrap both engine.forward() and loss
computation in their own torch.autocast context, and how DeepSpeed
handles the resulting nested autocast.

Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
The nesting note is better kept only in training.rst.

Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
@tohtana tohtana requested review from loadams and tjruwase as code owners March 4, 2026 02:21
Copy link
Collaborator

@stas00 stas00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much - this is great

added a small fix to the text

Co-authored-by: Stas Bekman <stas00@users.noreply.github.com>
@tohtana tohtana merged commit 4dba1e2 into deepspeedai:master Mar 4, 2026
2 checks passed
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.

2 participants