Views
No views yet
optimum[onnxruntime], done by TigreGotico.optimum-cli export onnx --model HiTZ/mt-hitz-eu-en --task text2text-generation-with-past --no-post-process mt-hitz-eu-en-onnxoptimum.onnxruntime.ORTQuantizer
(AVX2 config, dynamic) into the int8/ subfolder.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.onnxtokenizer(text) + model.generate() is sufficient.num_beams=4, max_new_tokens=64),
exact-match against the original PyTorch MarianMTModel output:| Basque | English (HiTZ / ONNX, identical) |
|---|---|
| Kaixo, zer moduz? | Hello, how are you? |
| Gaur eguraldia oso ona da. | The weather is very good today. |
| Bi lagunentzako mahai bat erreserbatu nahi nuke. | I would like to reserve a table for two people. |
| Non dago tren geltokia? | Where is the train station? |
| Liburu hau oso interesgarria da. | This book is very interesting. |
| Umeek parkean jolasten dute. | Kids play in the park. |
| Ordenagailuarekin laguntza behar dut. | I need help with my computer. |
| Bilera goizeko hamarretan hasiko da. | The meeting begins at ten in the morning. |
1from transformers import AutoTokenizer
2from optimum.onnxruntime import ORTModelForSeq2SeqLM
3
4tok = AutoTokenizer.from_pretrained("TigreGotico/mt-hitz-eu-en-onnx")
5model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/mt-hitz-eu-en-onnx")
6# int8: ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/mt-hitz-eu-en-onnx", subfolder="int8")
7
8batch = tok(["Kaixo, zer moduz?"], return_tensors="pt")
9generated = model.generate(**batch, num_beams=4, max_new_tokens=64)
10print(tok.batch_decode(generated, skip_special_tokens=True))
11# ['Hello, how are you?']