Views
No views yet
optimum[onnxruntime], done by TigreGotico.optimum-cli export onnx --model HiTZ/mt-hitz-es-eu --task text2text-generation-with-past --no-post-process es-euonnxruntime.quantization.quantize_dynamic (QUInt8) into the int8/ subfolder.es-eu/
encoder_model.onnx # fp32
decoder_model.onnx # fp32
decoder_with_past_model.onnx # fp32
config.json, generation_config.json
source.spm, target.spm, vocab.json, tokenizer_config.json, special_tokens_map.json
int8/
encoder_model.onnx
decoder_model.onnx
decoder_with_past_model.onnxnum_beams=4,
max_new_tokens=64), exact-match against the original PyTorch MarianMTModel output:Zer moduz zabiltzate, kamaradaz, eta ez da ezertxo ere gertatzen.Zer moduz zabiltzate, kamaradaz, eta ez da ezertxo ere gertatzen.kaixo, zer moduz zaude?1from transformers import AutoTokenizer
2from optimum.onnxruntime import ORTModelForSeq2SeqLM
3
4tok = AutoTokenizer.from_pretrained("TigreGotico/mt-hitz-es-eu-onnx")
5
6# fp32 (default, root of the repo)
7model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/mt-hitz-es-eu-onnx")
8
9# int8 (smaller / faster, subfolder)
10# download the repo and load from the local "int8" folder, e.g.:
11# from huggingface_hub import snapshot_download
12# path = snapshot_download("TigreGotico/mt-hitz-es-eu-onnx")
13# model = ORTModelForSeq2SeqLM.from_pretrained(path + "/int8")
14
15batch = tok(["your sentence here"], return_tensors="pt")
16generated = model.generate(**batch, num_beams=4, max_new_tokens=64)
17print(tok.batch_decode(generated, skip_special_tokens=True))