[feature] Reduce memory usage with SP (#7728)

Signed-off-by: Maciej Bala <mbala@nvidia.com>
This commit is contained in:
MaciejBalaNV authored and GitHub committed 2026-10-07 22:36:32 +08:00
1 parent 3dc35694b3
commit e54e185593
7 files changed
+475 -17

No files matched your search

+3
View File
@@ -1620,6 +1620,9 @@ def extract_cosmos3_context(
control_weights=control_weights,
transfer_share_vision_temporal_positions=transfer_share_vision_temporal_positions,
)
# Cache residuals stay rank-local: shard before the context and its
# closures retain prep; postprocess gathers on both misses and hits.
prep = module._shard_gen_prep(prep, defer_gather=True)
def run_transformer_blocks() -> tuple[torch.Tensor, ...]:
return (module._run_gen_stack(prep),)