daveycodez commited on
Commit
a405c7f
·
verified ·
1 Parent(s): 5bc567e

Remove the Reshape that duplicated the embedding at load

Browse files
Files changed (2) hide show
  1. README.md +1 -0
  2. onnx/model_q4f16.onnx +2 -2
README.md CHANGED
@@ -26,6 +26,7 @@ This repository contains modified files. Compared with [onnx-community/LFM3-1.7B
26
 
27
  - **Re-quantized weights:** all `MatMulNBits` weights were re-quantized from the fp16 ONNX model with GPTQ (4-bit, block size 128, with zero points). The tied embedding / LM head uses round-to-nearest 4-bit, block size 128, with a clip search.
28
  - **Shorter rotary caches:** the cos/sin caches were cut from 262,144 to 16,384 positions. Sequences longer than 16,384 tokens fail with a clear error instead of running.
 
29
  - **Calibration data:** about 36k tokens from the WikiText-2 training split plus chat replies generated by the fp16 model. No calibration text is included in the files.
30
 
31
  `config.json`, the tokenizer files and the chat template are unchanged.
 
26
 
27
  - **Re-quantized weights:** all `MatMulNBits` weights were re-quantized from the fp16 ONNX model with GPTQ (4-bit, block size 128, with zero points). The tied embedding / LM head uses round-to-nearest 4-bit, block size 128, with a clip search.
28
  - **Shorter rotary caches:** the cos/sin caches were cut from 262,144 to 16,384 positions. Sequences longer than 16,384 tokens fail with a clear error instead of running.
29
+ - **No second copy of the embedding at load:** in the original graph, a `Reshape` feeds the shared embedding / LM-head weights to the LM head, which makes onnxruntime-web copy that 131 MB tensor while creating the session (about +390 MB of wasm heap and +131 MB of GPU memory). The graph now gives the LM head the same weights without the `Reshape`. Outputs are identical.
30
  - **Calibration data:** about 36k tokens from the WikiText-2 training split plus chat replies generated by the fp16 model. No calibration text is included in the files.
31
 
32
  `config.json`, the tokenizer files and the chat template are unchanged.
onnx/model_q4f16.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:43c35780930fa7a85ab7e06d2078259517c81805eac5f47b7ceb3d3edf89da50
3
- size 310898
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4bc2c0f1a3ebf6f32e8da253c1cf01d05b1b8f8100e5ad5ca647de80335882a
3
+ size 310650