From 83433975844ca42673473b0823a2880c539357f1 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 6 Oct 2026 00:21:40 -0700 Subject: [PATCH] frank-primary: merged PLE file must sort before the raw shards The reader opens every index-named file in sorted order and emplaces EVERY tensor each file physically holds, first-wins (checkpoint.cpp add_shard + shard_list). The raw model-000NN shards carry tensors named ...ple.ple_embedding.ngram_embedding.shard_0.weight ([2500012,160] fp8) - the identical name the plugin asks the merged table under - so ple.merged.safetensors lost the emplace race and the plan read one raw shard as the codes (declared [320001536,160] vs codes [2500012,160]). Rename to 00-ple.merged.safetensors: '00-' wins the sort, the merged bf16 tensor wins the name, table_bf16 declares and the rtn rule makes the fp8 container form. --- scripts/stack-qwen38-official-fp8.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/stack-qwen38-official-fp8.py b/scripts/stack-qwen38-official-fp8.py index 3604cc0..106e983 100755 --- a/scripts/stack-qwen38-official-fp8.py +++ b/scripts/stack-qwen38-official-fp8.py @@ -377,7 +377,14 @@ def main(): log(f"experts stacked: {written_total / 2**30:.2f} GiB in {len(prefixes)} files") # ---- stage PLE -------------------------------------------------------- - out_name = "ple.merged.safetensors" + # The file name sorts BEFORE the model-000NN shards ON PURPOSE: the reader + # opens every index-named file in sorted order and emplaces EVERY tensor + # it physically holds, first-wins (checkpoint.cpp add_shard). The raw + # shards carry tensors of the SAME name as the merged one + # (...ple.ple_embedding.ngram_embedding.shard_0.weight, [2500012,160] + # fp8), so ple.merged.safetensors lost the race and the plan read one raw + # shard as the codes. "00-" wins the sort and the name. + out_name = "00-ple.merged.safetensors" out_path = os.path.join(stage, out_name) data_bytes = total_rows * hd * 2 hdr = {merged_name: {"dtype": BF16, "shape": [total_rows, hd],