Downloads · 30 days
5
7% of all-time downloads
naranor/ModernBERT-base-ONNX-Attentions
ModernBERT-base-ONNX-Attentions is a feature extraction model from naranor. Use it when you need embeddings to search or compare text. It is set up for onnx. The card lists the license as apache-2.0.
This is an optimized version of the ModernBERT-base model, exported to ONNX with explicit support for attention weights and INT8 dynamic quantization.
Downloads · 30 days
5
7% of all-time downloads
All-time downloads
68
Public
Repo size
747 MB
Likes
0
Public
Click a slice to open those files.
.onnx747 MB · 100%
From the Hugging Face model README
This is an optimized version of the ModernBERT-base model, exported to ONNX with explicit support for attention weights and INT8 dynamic quantization.
output_attentions flag enabled in the graph. You can access matrices for all 22 layers (including Global and Local attention).model_quantized.onnx file is 4x smaller (~150MB) and significantly faster on CPUs with AVX-512/VNNI support.model.onnx: Full FP32 model (supports attention).model_quantized.onnx: INT8 Quantized model (supports attention).tokenizer.json: Standard ModernBERT tokenizer.config.json & ort_config.json: Configuration files.import onnxruntime as ort
from transformers import AutoTokenizer
import numpy as np
# Load quantized model
session = ort.InferenceSession("model_quantized.onnx")
tokenizer = AutoTokenizer.from_pretrained(".")
inputs = tokenizer("Your text here", return_tensors="np")
# Request only the last layer of attention for efficiency
outputs = session.run(["attentions.21"], dict(inputs))
# attentions.21 shape: [batch, heads, seq, seq]
last_layer_attn = outputs[0]
print(last_layer_attn.shape)
Ideal for:
Apache 2.0 (same as base model).
Created using jaagent context optimization tools.