ONNX Model Zoo

Mr-Corentin/myhaiku-gemma-3-270m-it-onnx

By Mr-Corentin · ↓ 0 · ♥ 0 · Updated 2025-10-20

What's in this repo

This page lists the files in Mr-Corentin/myhaiku-gemma-3-270m-it-onnx, including model.onnx, model_fp16.onnx, model_q4.onnx and more.

  • 5 ONNX models (.onnx files)
  • 20 files, including 6 .json, 5 .onnx, 5 .onnx_data, 1 .md, 1 .jinja, 1 .model
  • Last updated 2025-10-20

ONNX files

File Size Download
onnx/model.onnx — Download
onnx/model_fp16.onnx — Download
onnx/model_q4.onnx — Download
onnx/model_q4f16.onnx — Download
onnx/model_q8.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

myhaiku-gemma-3-270m-it (ONNX)

This repository contains ONNX exports of the fine-tuned Gemma model: 👉 Mr-Corentin/myhaiku-gemma-3-270m-it

These ONNX models are optimized for efficient inference with ONNX Runtime, suitable for deployment on CPU, GPU, or WebGPU backends.


Model Summary

Property Description
Base model google/gemma-3-270m-it
Fine-tuned model Mr-Corentin/myhaiku-gemma-3-270m-it
Export type ONNX (fp32, fp16, q8, q4, q4f16)
Framework ONNX Runtime
Use case Text generation (Haiku generation)

Available Model Variants

File Precision Notes
onnx/model.onnx FP32 Full precision reference
onnx/model_fp16.onnx FP16 Recommended for GPU
onnx/model_q8.onnx INT4 8-bit weights
onnx/model_q4.onnx INT4 4-bit weights, compact but lower fidelity
onnx/model_q4f16.onnx INT4 weights + FP16 activations

All models share the same tokenizer and configuration files.


🚀 Usage Example

from transformers import AutoConfig, AutoTokenizer, GenerationConfig
import onnxruntime
import numpy as np

save_path = "path/to/myhaiku-gemma-3-270m-it-onnx"
config = AutoConfig.from_pretrained(save_path)
generation_config = GenerationConfig.from_pretrained(save_path)
tokenizer = AutoTokenizer.from_pretrained(save_path)

model_path = f"{save_path}/onnx/model_fp16.onnx"
session = onnxruntime.InferenceSession(model_path)

prompt = "Write a haiku about the beauty of autumn."
messages = [
    {"role": "system", "content": "You are a haiku generator. Reply with exactly three short lines, no extra text."},
    {"role": "user", "content": prompt},
]

inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="np")
input_ids = inputs["input_ids"]
attention_mask = inputs["attention_mask"]

# Run inference (example for 1 token generation)
logits = session.run(None, {"input_ids": input_ids, "attention_mask": attention_mask})[0]
next_token = np.argmax(logits[:, -1, :], axis=-1)
print(tokenizer.decode(next_token[0]))

License

This model and code are released under the MIT license.


Credits

Model info

text-generation onnxruntime
onnxruntime onnx gemma3_text quantized text-generation conversational base_model:Mr-Corentin/myhaiku-gemma-3-270m-it base_model:quantized:Mr-Corentin/myhaiku-gemma-3-270m-it license:mit region:us
↓ 0 ♥ 0

Created: 2025-10-17

Updated: 2025-10-20

View on Hugging Face

Files (20)

.gitattributes
README.md
added_tokens.json
chat_template.jinja
config.json
generation_config.json
onnx/model.onnx ONNX
onnx/model.onnx_data
onnx/model_fp16.onnx ONNX
onnx/model_fp16.onnx_data
onnx/model_q4.onnx ONNX
onnx/model_q4.onnx_data
onnx/model_q4f16.onnx ONNX
onnx/model_q4f16.onnx_data
onnx/model_q8.onnx ONNX
onnx/model_q8.onnx_data
special_tokens_map.json
tokenizer.json
tokenizer.model
tokenizer_config.json

Related models