Feature Extraction
sentence-transformers
ONNX
Safetensors
modernbert
code-search
code-embedding
retrieval
dense
text-embeddings-inference
Shuu12121's picture
Add validated FP32 and INT8 ONNX exports
cfc3c6d verified
|
Raw History Blame Contribute Delete
1.47 kB

ONNX exports

Source: Shuu12121/NightOwl-CodeEmbedding

File Precision
model.onnx FP32
model_quantized.onnx Dynamic INT8 (constant MatMul and Gather weights)

Inputs: input_ids and attention_mask, int64 [batch, sequence]. Output: last_hidden_state. Take the first token, then L2-normalize to obtain 768-dimensional embeddings. Maximum input: 1024 tokens. Use the tokenizer/configuration at the repository root. Query/document prefixes are not required.

Node.js short-input example (Transformers.js 4.2.0):

import { pipeline } from '@huggingface/transformers';
const extractor = await pipeline('feature-extraction', 'Shuu12121/NightOwl-CodeEmbedding', {
  dtype: 'q8', device: 'cpu',
});
const output = await extractor('parse a JSON string', { pooling: 'cls', normalize: true });
console.log(output.dims); // [1, 768]
await extractor.dispose();

For long inputs, truncate the content to 1022 tokens before adding CLS and SEP. Transformers.js 4.2.0's default truncation slices the final sequence and can remove SEP; preserve both special tokens for parity with the Python tokenizer.

manifest.json records the source commit, export settings, validation results and SHA256 checksums. These exports use opset 17. The original model's license and usage terms apply. INT8 output embeddings remain FP32.