DeepSpeed
bf222a2a - Fix scalar parameter byte-view broadcasts (#8642)

Commit
6 days ago
Fix scalar parameter byte-view broadcasts (#8642) Fixes #8639. PyTorch rejects reinterpreting a zero-dimensional tensor as `uint8` when the element sizes differ. DeepSpeed uses that byte view in model and ZeRO parameter broadcasts, so a scalar parameter fails during initialization. Unsqueezing only scalar tensors creates a one-dimensional view of the same storage before the byte reinterpretation; non-scalar tensors keep the existing path. Tested with a two-rank CPU/Gloo regression on Python 3.12 and PyTorch 2.12.1: ZeRO stages 0 and 3 both pass with this change. The same stage-0 test fails on the unmodified base with the reported `self.dim() cannot be 0` error. Repository formatting/static hooks, `py_compile`, and `git diff --check` pass. A newer Linux flake8 reports three warnings already present on the base; excluding only those unchanged warnings leaves no lint findings in the changed files. GPU distributed execution was not tested. Prepared with AI assistance; I reviewed the diff and ran the tests above. Signed-off-by: Xucheng Zhou <aden1350@outlook.com>
Author
Parents
Loading