ONNX Model Zoo

dreuxx26/HRM-Grammar-Light_ONNX-int8

By dreuxx26 · ↓ 0 · ♥ 0 · Updated 2025-08-12

What's in this repo

This page lists the files in dreuxx26/HRM-Grammar-Light_ONNX-int8, including hrm_grammar_light_ACT4.onnx, hrm_grammar_light_ACT4_int8.onnx, hrm_grammar_light_ACT5.onnx and more.

  • 4 ONNX models (.onnx files)
  • 8 files, including 4 .onnx, 2 .data, 1 .md
  • Last updated 2025-08-12

ONNX files

File Size Download
hrm_grammar_light_ACT4.onnx — Download
hrm_grammar_light_ACT4_int8.onnx — Download
hrm_grammar_light_ACT5.onnx — Download
hrm_grammar_light_ACT5_int8.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

HRM-Grammar-Light ONNX (int8)

Lightweight multilingual grammar correction model, exported to ONNX and quantized to int8 for efficient inference.

What does this model do?

It corrects text in multiple languages. Given a prompt like:

corregir español: el casa es grande

it generates the corrected version:

La casa es grande.

Included files

  • hrm_grammar_light.onnx: standard precision (fp32) ONNX export ACT 4 o ACT 5
  • hrm_grammar_light_int8.onnx: int8 quantized ONNX (smaller, faster)

How to use (Python + ONNX Runtime)

import onnxruntime as ort
import numpy as np

# Load model
session = ort.InferenceSession("hrm_grammar_light_int8.onnx")

# Prepare your input sequence (tokenized, see below)
input_ids = np.array([[...]], dtype=np.int64)  # shape (1, seq_len)
attention_mask = np.ones_like(input_ids)

# Run inference
outputs = session.run(["logits"], {
    "input_ids": input_ids,
    "labels": None,
    "attention_mask": attention_mask,
    "language_ids": None
})
logits = outputs[0]  # (1, seq_len, vocab_size)

Tokenization

This model uses the t5-small vocabulary (Hugging Face Transformers). To tokenize:

from transformers import T5Tokenizer

tokenizer = T5Tokenizer.from_pretrained("t5-small")
prompt = "corregir español: el casa es grande"
input_ids = tokenizer(prompt, return_tensors="np", padding="max_length", max_length=256, truncation=True)["input_ids"]

Notes

  • The model expects prompts like: corregir <language>: <text> EX: corregir ingles: .....
  • Supports Spanish, English, French, German, Russian, and more (see original README).
  • Output is logits; to decode, apply argmax and then use tokenizer.decode.
  • For maximum speed, use the int8 model.

License

https://huggingface.co/dreuxx26/HRM-Grammar-Light

Model info

onnx en ru es de fr license:apache-2.0 region:us
↓ 0 ♥ 0

Created: 2025-08-11

Updated: 2025-08-12

View on Hugging Face

Files (8)

.gitattributes
README.md
hrm_grammar_light_ACT4.onnx ONNX
hrm_grammar_light_ACT4.onnx.data
hrm_grammar_light_ACT4_int8.onnx ONNX
hrm_grammar_light_ACT5.onnx ONNX
hrm_grammar_light_ACT5.onnx.data
hrm_grammar_light_ACT5_int8.onnx ONNX

Related models