Fix safetensors export OOM - #193
Merged
Merged
Conversation
…t PLE table; cross-PP PLE shard transfer
…): resolve ple.py -- keep modelscope#192 unified naming + chunked all_reduce with CPU accumulation
- ple.py: split export_table_to_hf into a generator (iter_export_table_to_hf) that yields one shard at a time; the bulk API remains as a thin wrapper - qwen4_exp.py: stage the shard iterator in _set_layer_ple and interleave the cross-PP broadcast per shard (_iter_ple_table_export); consumed at _convert's yield point so no rank accumulates the 100GB-scale table in host memory - gpt_bridge.py: drain the staged iterator at the per-layer yield point and make the per-layer yield lazy Verified: 13 unit tests (modelscope#192's test_ple_checkpoint included), medium e2e TP2xPP2xEP2xETP2 (0 missing keys), and a load->export roundtrip that is bit-exact on all 16 PLE shards and 12 sampled other weights
…ad of hardcoding fp8 Any low-width dtype (fp8 e4m3/e5m2, int8, packed fp4, ...) now rides as a flattened uint8 payload; the meta carries the original shape/dtype and the receiver views back. Removes the float8_e4m3fn-only special case.
- _chunk_rows returns max(1, min(rows, shape[0])) so a zero-row shape can never produce range(0, 0, 0) in _chunked_broadcast_pp (currently unreachable -- PLE shards have >= 1 row and _broadcast_pp_weight only calls in with a non-empty meta -- but a robustness gap, not a live bug) - extract elem_size in _broadcast_ep_pp's gate to fix flake8 E125
tastelikefeet
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.