Feature Extraction
Transformers
ONNX
Russian
bert
pretraining
rubert
russian
embeddings
text-embeddings-inference
Instructions to use KvaytG/rubert-tiny2-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KvaytG/rubert-tiny2-onnx with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="KvaytG/rubert-tiny2-onnx")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForPreTraining tokenizer = AutoTokenizer.from_pretrained("KvaytG/rubert-tiny2-onnx") model = AutoModelForPreTraining.from_pretrained("KvaytG/rubert-tiny2-onnx", device_map="auto") - Notebooks
- Google Colab
- Kaggle
rubert-tiny2-onnx
ONNX version of cointegrated/rubert-tiny2, a compact Russian language model.
This repository contains the model exported to ONNX format for inference with ONNX Runtime. It can be used to extract contextual token representations and generate text embeddings through mean pooling.
Features
- Russian language support
- ONNX inference
- Compatible with Hugging Face Transformers and Optimum
- Mean pooling for sentence embeddings
- ONNX opset 14
Installation
pip install torch transformers optimum onnxruntime
Usage
import torch
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForFeatureExtraction
model_id = "KvaytG/rubert-tiny2-onnx"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = ORTModelForFeatureExtraction.from_pretrained(model_id)
texts = [
"Привет, мир!",
"Как дела?",
]
inputs = tokenizer(
texts,
padding=True,
truncation=True,
max_length=128,
return_tensors="pt",
)
with torch.no_grad():
outputs = model(**inputs)
hidden = outputs.last_hidden_state
mask = inputs["attention_mask"].unsqueeze(-1).float()
embeddings = (
(hidden * mask).sum(dim=1) / mask.sum(dim=1).clamp(min=1e-9)
)
print(embeddings.shape) # torch.Size([2, 312])
The resulting embeddings tensor contains one vector per input text.
Model Details
- Base model: cointegrated/rubert-tiny2
- Format: ONNX
- ONNX opset: 14
- Task: Feature extraction
- Output:
last_hidden_state - Pooling: Mean pooling with attention mask
- Language: Russian
License
This model is distributed under the MIT license, following the license of the original model, cointegrated/rubert-tiny2.
References
Citation
@misc{kvaytg_rubert_tiny2_onnx,
author = {KvaytG},
title = {RuBERT-tiny2 ONNX},
year = {2026},
publisher = {Hugging Face},
journal = {Hugging Face Models},
url = {https://huggingface.co/KvaytG/rubert-tiny2-onnx},
note = {ONNX export of cointegrated/rubert-tiny2 for Russian text feature extraction and embeddings}
}
- Downloads last month
- -
Model tree for KvaytG/rubert-tiny2-onnx
Base model
cointegrated/rubert-tiny2