Shuu12121 commited on
Commit
d53613d
·
verified ·
1 Parent(s): b9522c8

Add validated FP32 and INT8 ONNX exports

Browse files
onnx/README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ONNX exports
2
+
3
+ Source: [Shuu12121/NightJar-CodeSearch-Embedding](https://huggingface.co/Shuu12121/NightJar-CodeSearch-Embedding/tree/b9522c84bad8b17d61373e2ebd7cf53d80c406d4)
4
+
5
+ | File | Precision |
6
+ | --- | --- |
7
+ | model.onnx | FP32 |
8
+ | model_quantized.onnx | Dynamic INT8 (constant MatMul and Gather weights) |
9
+
10
+ Inputs: `input_ids` and `attention_mask`, int64 `[batch, sequence]`.
11
+ Output: `last_hidden_state`. Take the first token, then L2-normalize to obtain
12
+ 768-dimensional embeddings. Maximum input: 1024 tokens.
13
+ Use the tokenizer/configuration at the repository root. Query/document prefixes are not required.
14
+
15
+ Node.js short-input example (Transformers.js 4.2.0):
16
+
17
+ ```javascript
18
+ import { pipeline } from '@huggingface/transformers';
19
+ const extractor = await pipeline('feature-extraction', 'Shuu12121/NightJar-CodeSearch-Embedding', {
20
+ dtype: 'q8', device: 'cpu',
21
+ });
22
+ const output = await extractor('parse a JSON string', { pooling: 'cls', normalize: true });
23
+ console.log(output.dims); // [1, 768]
24
+ await extractor.dispose();
25
+ ```
26
+
27
+ For long inputs, truncate the content to 1022 tokens before adding
28
+ CLS and SEP. Transformers.js 4.2.0's default truncation slices the final sequence and
29
+ can remove SEP; preserve both special tokens for parity with the Python tokenizer.
30
+
31
+ `manifest.json` records the source commit, export settings, validation results and
32
+ SHA256 checksums. These exports use opset 17. The original model's
33
+ license and usage terms apply. INT8 output embeddings remain FP32.
onnx/manifest.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": 1,
3
+ "model_id": "Shuu12121/NightJar-CodeSearch-Embedding",
4
+ "revision": "b9522c84bad8b17d61373e2ebd7cf53d80c406d4",
5
+ "max_length": 1024,
6
+ "dimensions": 768,
7
+ "pooling": "cls",
8
+ "normalize": true,
9
+ "opset": 17,
10
+ "quantization": "dynamic QInt8, per-channel MatMul and Gather weights",
11
+ "files": {
12
+ "model.onnx": 438209760,
13
+ "model_quantized.onnx": 110392861
14
+ },
15
+ "validation": {
16
+ "model.onnx": {
17
+ "min_cosine_to_pytorch": 0.9999998736126565,
18
+ "max_abs_error": 1.7881393432617188e-07
19
+ },
20
+ "model_quantized.onnx": {
21
+ "min_cosine_to_pytorch": 0.9995053808395933,
22
+ "max_abs_error": 0.003841400146484375
23
+ }
24
+ },
25
+ "versions": {
26
+ "torch": "2.9.1",
27
+ "transformers": "4.57.6",
28
+ "sentence-transformers": "5.7.0",
29
+ "optimum-onnx": "0.1.0",
30
+ "onnxruntime": "1.29.0"
31
+ },
32
+ "sha256": {
33
+ "model.onnx": "80365539adaafde121c2d97a92fb0dae3c70e041dd0c2908ce53da0e3665665b",
34
+ "model_quantized.onnx": "4232e176e2ebc27e80e340e83c806420df3d2f5b72bf4db2f005f23ce37f7e65"
35
+ }
36
+ }
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80365539adaafde121c2d97a92fb0dae3c70e041dd0c2908ce53da0e3665665b
3
+ size 438209760
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4232e176e2ebc27e80e340e83c806420df3d2f5b72bf4db2f005f23ce37f7e65
3
+ size 110392861