Instructions to use Shuu12121/NightOwl-CodeEmbedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Shuu12121/NightOwl-CodeEmbedding with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Shuu12121/NightOwl-CodeEmbedding") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Download onnx/README.md from Shuu12121/NightOwl-CodeEmbedding: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/Shuu12121/NightOwl-CodeEmbedding/resolve/main/onnx/README.md
- Command line
-
hf download hf://Shuu12121/NightOwl-CodeEmbedding/onnx/README.md
-
curl -L -o README.md https://huggingface.co/Shuu12121/NightOwl-CodeEmbedding/resolve/main/onnx/README.md
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.