onnx-community/NeoBERT-ONNX
By onnx-community · ↓ 3 · ♥ 0 · Updated 2025-07-01
What's in this repo
This page lists the files in onnx-community/NeoBERT-ONNX, including model.onnx, model_bnb4.onnx, model_fp16.onnx and more.
- 8 ONNX models (.onnx files)
- 16 files, including 8 .onnx, 4 .json, 1 .md, 1 .py, 1 .txt
- Last updated 2025-07-01
ONNX files
| File | Size | Download |
|---|---|---|
| onnx/model.onnx | — | Download |
| onnx/model_bnb4.onnx | — | Download |
| onnx/model_fp16.onnx | — | Download |
| onnx/model_int8.onnx | — | Download |
| onnx/model_q4.onnx | — | Download |
| onnx/model_q4f16.onnx | — | Download |
| onnx/model_quantized.onnx | — | Download |
| onnx/model_uint8.onnx | — | Download |
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
NeoBERT
NeoBERT is a next-generation encoder model for English text representation, pre-trained from scratch on the RefinedWeb dataset. NeoBERT integrates state-of-the-art advancements in architecture, modern data, and optimized pre-training methodologies. It is designed for seamless adoption: it serves as a plug-and-play replacement for existing base models, relies on an optimal depth-to-width ratio, and leverages an extended context length of 4,096 tokens. Despite its compact 250M parameter footprint, it is the most efficient model of its kind and achieves state-of-the-art results on the massive MTEB benchmark, outperforming BERT large, RoBERTa large, NomicBERT, and ModernBERT under identical fine-tuning conditions.
Usage
Transformers.js
If you haven't already, you can install the Transformers.js JavaScript library from NPM using:
npm i @huggingface/transformers
You can then compute embeddings using the pipeline API:
import { pipeline } from "@huggingface/transformers";
// Create feature extraction pipeline
const extractor = await pipeline("feature-extraction", "onnx-community/NeoBERT-ONNX");
// Compute embeddings
const text = "NeoBERT is the most efficient model of its kind!";
const embedding = await extractor(text, { pooling: "cls" });
console.log(embedding.dims); // [1, 768]
Or manually with the model and tokenizer classes:
import { AutoModel, AutoTokenizer } from "@huggingface/transformers";
// Load model and tokenizer
const model_id = "onnx-community/NeoBERT-ONNX";
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
const model = await AutoModel.from_pretrained(model_id);
// Tokenize input text
const text = "NeoBERT is the most efficient model of its kind!";
const inputs = tokenizer(text);
// Generate embeddings
const outputs = await model(inputs);
const embedding = outputs.last_hidden_state.slice(null, 0);
console.log(embedding.dims); // [1, 768]
ONNXRuntime
from transformers import AutoTokenizer
from huggingface_hub import hf_hub_download
import onnxruntime as ort
model_id = "onnx-community/NeoBERT-ONNX"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model_file = hf_hub_download(model_id, filename="onnx/model.onnx")
session = ort.InferenceSession(model_file)
text = ["NeoBERT is the most efficient model of its kind!"]
inputs = tokenizer(text, return_tensors="np").data
outputs = session.run(None, inputs)[0]
embeddings = outputs[:, 0, :]
print(f"{embeddings.shape=}") # (1, 768)
Conversion
The export script can be found at ./export.py.
Model info
Created: 2025-07-01
Updated: 2025-07-01
View on Hugging Face