ONNX Model Zoo

Vades/rubert-tiny2-onnx-optim

By Vades · ↓ 0 · ♥ 0 · Updated 2026-02-02

What's in this repo

This page lists the files in Vades/rubert-tiny2-onnx-optim, including model_optimized.onnx.

  • 1 ONNX models (.onnx files)
  • 9 files, including 5 .json, 1 .md, 1 .onnx, 1 .txt
  • Last updated 2026-02-02

ONNX files

File Size Download
bert-onnx-optim/model_optimized.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

import torch from optimum.onnxruntime import ORTModelForFeatureExtraction from transformers import AutoTokenizer import numpy as np

model_path = ".../bert-onnx-optim/" file_name = "model_optimized.onnx"

encoder = ORTModelForFeatureExtraction.from_pretrained( model_path, file_name=file_name ) tokenizer = AutoTokenizer.from_pretrained(model_path)

def encode(self, texts, batch_size=8, normalize=True): """ Fetch embeddings for text :input: Any (str/list): text int: batch size bool: need normilize

    :output:
        list: list fetch embeddings
"""
log.debug(f"Data: {texts}")
if isinstance(texts, str):
    texts = [texts]
all_embeddings = []
for i in range(0, len(texts), batch_size):
    batch = texts[i:i+batch_size]
    inputs = self.tokenizer(batch, return_tensors="pt", padding=True, truncation=True)

    with torch.no_grad():
        outputs = self.encoder(**inputs)
        embeddings = outputs.last_hidden_state.mean(dim=1)

    if normalize:
        embeddings = torch.nn.functional.normalize(embeddings, p=2, dim=1)
    all_embeddings.append(embeddings.cpu().numpy())
return np.vstack(all_embeddings)

Model info

onnx text-classification ru base_model:cointegrated/rubert-tiny2 base_model:quantized:cointegrated/rubert-tiny2 region:us
↓ 0 ♥ 0

Created: 2026-01-20

Updated: 2026-02-02

View on Hugging Face

Files (9)

.gitattributes
README.md
bert-onnx-optim/config.json
bert-onnx-optim/model_optimized.onnx ONNX
bert-onnx-optim/ort_config.json
bert-onnx-optim/special_tokens_map.json
bert-onnx-optim/tokenizer.json
bert-onnx-optim/tokenizer_config.json
bert-onnx-optim/vocab.txt

Related models