gpt2 โ ONNX
ONNX export of openai-community/gpt2, published by Liodon AI.
Exported with optimum (optimum.exporters.onnx.main_export,
task text-generation-with-past, so the graph exposes past-key-value inputs/outputs for KV-cached
autoregressive decoding).
Files
| File | Size | Notes |
|---|---|---|
model.onnx |
0.65 GB | FP32, full precision |
model_quantized.onnx |
0.16 GB | Dynamic INT8 (weight-only, no calibration) |
Quick Start
import onnxruntime as ort
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("liodon-ai/gpt2-ONNX")
sess = ort.InferenceSession("model_quantized.onnx", providers=["CPUExecutionProvider"])
# past_key_values.*.key / .value inputs must be supplied (zero-length tensors
# for the first forward pass) -- see optimum's ORTModelForCausalLM for a
# ready-made wrapper that handles KV-cache bookkeeping automatically:
# from optimum.onnxruntime import ORTModelForCausalLM
# model = ORTModelForCausalLM.from_pretrained("liodon-ai/gpt2-ONNX", file_name="model_quantized.onnx")
Source
- Model: openai-community/gpt2
- License: other
Exported by Liodon AI
- Downloads last month
- -
Model tree for liodon-ai/gpt2-ONNX
Base model
openai-community/gpt2