ONNX Model Zoo

voxreality/src_ctx_aware_nllb_1.3B_onnx

By voxreality · ↓ 0 · ♥ 0 · Updated 2025-05-12

What's in this repo

This page lists the files in voxreality/src_ctx_aware_nllb_1.3B_onnx, including decoder_model.onnx, decoder_with_past_model.onnx, encoder_model.onnx.

  • 3 ONNX models (.onnx files)
  • 15 files, including 5 .json, 4 .onnx_data, 3 .onnx, 1 .md, 1 .model
  • Last updated 2025-05-12

ONNX files

File Size Download
decoder_model.onnx — Download
decoder_with_past_model.onnx — Download
encoder_model.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

ONNX format of voxreality/src_ctx_aware_nllb_1.3B model

Model inference example:

from optimum.onnxruntime import ORTModelForSeq2SeqLM
from transformers import AutoTokenizer,pipeline

model_path = 'models/src_ctx_aware_nllb_1.3B_onnx'

model = ORTModelForSeq2SeqLM.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)

max_length = 100
src_lang = 'eng_Latn'
tgt_lang = 'deu_Latn'
context_text = 'This is an optional context sentence.'
sentence_text = 'Text to be translated.'

# If the context is provided
input_text = f'{context_text} {tokenizer.sep_token} {sentence_text}'
# If no context is provided, you can use just the sentence_text as input
# input_text = sentence_text

tokenizer.src_lang = src_lang

inputs = tokenizer(input_text, return_tensors='pt')

input = inputs.to('cpu')

forced_bos_token_id = tokenizer.lang_code_to_id[tgt_lang]

output = model.generate(
    **inputs,
    forced_bos_token_id=forced_bos_token_id,
    max_length=max_length
)

output_text = tokenizer.batch_decode(output, skip_special_tokens=True)[0]

print(output_text)

Model info

onnx m2m_100 license:apache-2.0 region:us
↓ 0 ♥ 0

Created: 2025-04-24

Updated: 2025-05-12

View on Hugging Face

Files (15)

.gitattributes
README.md
config.json
decoder_model.onnx ONNX
decoder_model.onnx_data
decoder_model_merged.onnx_data
decoder_with_past_model.onnx ONNX
decoder_with_past_model.onnx_data
encoder_model.onnx ONNX
encoder_model.onnx_data
generation_config.json
sentencepiece.bpe.model
special_tokens_map.json
tokenizer.json
tokenizer_config.json

Related models