Fix DeepSpeed SP loss aggregation and LocalLayerRepository kwargs (#47073)
* Fix DeepSpeed SP loss aggregation and LocalLayerRepository kwargs
Replace the Python conditional loop in deepspeed_sp_compute_loss with tensor-only aggregation via torch.where, avoiding CUDA host sync and preventing NaN losses on zero-token ranks from polluting the total. Remove the unsupported package_name argument from LocalLayerRepository calls so ty check and local kernel loading match the installed kernels
API.
Fixes #47068
* Fix DeepSpeed SP loss aggregation for zero-token ranks
Replace the Python conditional loop in deepspeed_sp_compute_loss with tensor-only aggregation via torch.where, avoiding CUDA host sync and preventing NaN losses on zero-token ranks from polluting the total.
Fixes #47068
* Fix DeepSpeed SP loss aggregation for zero-token ranks
Replace the Python conditional loop in deepspeed_sp_compute_loss with
tensor-only aggregation via torch.where, avoiding CUDA host sync and
preventing NaN losses on zero-token ranks from polluting the total.
Fixes #47068
Co-authored-by: Myeongsu Koo <rnaudtndi@naver.com>
* Address review: inline SP loss aggregation, drop dedicated test
Fixes #47068
Co-authored-by: Myeongsu Koo <rnaudtndi@naver.com>
---------
Co-authored-by: Myeongsu Koo <rnaudtndi@naver.com>