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.
This commit is contained in:
Frank
2026-10-06 00:21:40 -07:00
parent 5e166543fa
commit 8343397584
+8 -1
View File
@@ -377,7 +377,14 @@ def main():
log(f"experts stacked: {written_total / 2**30:.2f} GiB in {len(prefixes)} files") log(f"experts stacked: {written_total / 2**30:.2f} GiB in {len(prefixes)} files")
# ---- stage PLE -------------------------------------------------------- # ---- 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) out_path = os.path.join(stage, out_name)
data_bytes = total_rows * hd * 2 data_bytes = total_rows * hd * 2
hdr = {merged_name: {"dtype": BF16, "shape": [total_rows, hd], hdr = {merged_name: {"dtype": BF16, "shape": [total_rows, hd],