"""tools/embd_bf16_pack.py - the token embedding exactly as the checkpoint ships it (BF16), as a GGUF the engine reads. python tools/embd_bf16_pack.py --model --out nvfp4_convert.py stores token_embd as Q8_0 (0.56% off per value). The engine keeps the table in mapped host memory and reads one row per token, so BF16 costs 0.6 GB of RAM more and no VRAM; `--embd-gguf` takes it from this file. The output is a one-tensor GGUF: `token_embd.weight`, ne = [n_embd, n_vocab], type BF16, the bytes copied straight out of the safetensors file - nothing decoded or rounded. """ import argparse import json import pathlib import struct import sys GGUF_TYPE_STRING = 8 GGML_TYPE_BF16 = 30 ALIGN = 32 CHUNK = 64 << 20 def safetensors_header(path): with open(path, "rb") as f: n = struct.unpack("