khaangnguyeen/ruri-v3-310m-onnx
By khaangnguyeen · ↓ 1 · ♥ 0 · Updated 2025-11-19
What's in this repo
This page lists the files in khaangnguyeen/ruri-v3-310m-onnx, including model.onnx.
- 1 ONNX models (.onnx files)
- 8 files, including 4 .json, 1 .md, 1 .onnx, 1 .model
- Last updated 2025-11-19
ONNX files
| File | Size | Download |
|---|---|---|
| model.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
Ruri v3 310M — ONNX Format
This is the ONNX version of the embedding model cl-nagoya/ruri-v3-310m.
Model Information
- Base Model: cl-nagoya/ruri-v3-310m
- Model Type: ModernBERT (encoder-only)
- Task: Feature Extraction / Sentence Embeddings
- ONNX Opset: 17
- Optimization: O2 (Medium)
Files
| File | Size |
|---|---|
| config.json | 0.00 MB |
| model.onnx | 1200.70 MB |
| special_tokens_map.json | 0.00 MB |
| tokenizer.json | 6.41 MB |
| tokenizer.model | 1.75 MB |
| tokenizer_config.json | 0.00 MB |
Usage
With Optimum (Recommended)
from optimum.onnxruntime import ORTModelForFeatureExtraction
from transformers import AutoTokenizer
import torch
# Load model and tokenizer
model = ORTModelForFeatureExtraction.from_pretrained(
"khaangnguyeen/ruri-v3-310m-onnx",
provider="CPUExecutionProvider" # or "CUDAExecutionProvider" for GPU
)
tokenizer = AutoTokenizer.from_pretrained("khaangnguyeen/ruri-v3-310m-onnx")
# Encode text
texts = ["Example sentence", "Another example"]
inputs = tokenizer(texts, padding=True, truncation=True, return_tensors="pt")
# Get embeddings
with torch.no_grad():
outputs = model(**inputs)
embeddings = outputs.last_hidden_state.mean(dim=1) # Mean pooling
print(embeddings.shape) # (2, hidden_size)
With ONNX Runtime (Direct)
import onnxruntime as ort
import numpy as np
from transformers import AutoTokenizer
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("khaangnguyeen/ruri-v3-310m-onnx")
# Create ONNX Runtime session
session = ort.InferenceSession("model.onnx")
# Prepare inputs
text = "Example sentence"
inputs = tokenizer(text, return_tensors="np", padding=True, truncation=True)
# Run inference
outputs = session.run(
None,
{
"input_ids": inputs["input_ids"],
"attention_mask": inputs["attention_mask"]
}
)
embeddings = outputs[0].mean(axis=1)
print(embeddings.shape)
Performance
ONNX Runtime provides:
- ⚡ Faster inference speed compared to PyTorch (typically 1.5-3x)
- 💾 Smaller footprint / optimized graph
- 🎯 Optimized for production deployment
- 🔧 Support for various hardware backends (CPU, GPU, NPU)
Benchmark
CPU Benchmark (example):
- PyTorch: ~XX.XX ms/sample
- ONNX Runtime: ~XX.XX ms/sample
- Speedup: ~X.XXx
License
Apache-2.0 (inherited from base model)
Citation
@misc{ruri-v3-onnx,
author = {khaangnguyeen},
title = {Ruri v3 310M ONNX},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{[https://huggingface.co/khaangnguyeen/ruri-v3-310m-onnx](https://huggingface.co/khaangnguyeen/ruri-v3-310m-onnx)}}
}
Model info
feature-extraction
transformers
transformers
onnx
modernbert
feature-extraction
sentence-transformers
sentence-similarity
en
multilingual
base_model:cl-nagoya/ruri-v3-310m
base_model:quantized:cl-nagoya/ruri-v3-310m
license:apache-2.0
text-embeddings-inference
↓ 1
♥ 0
Created: 2025-11-19
Updated: 2025-11-19
View on Hugging FaceFiles (8)
.gitattributes
README.md
config.json
model.onnx
ONNX
special_tokens_map.json
tokenizer.json
tokenizer.model
tokenizer_config.json
Related models
More from khaangnguyeen
No other models by this author.