Views
No views yet
⚠️ See Disclaimer below before using.
mldb.ONNXSeq2Seq BYOM function.onnx/model-fp32.onnx — full-precision ONNX graphtokenizer.json — repacked Marian tokenizer suitable for BYOMconfig.json — model architecture metadata, copied unchanged from the upstream repogeneration_config.json — generation defaults, copied unchanged from the upstream repoonnx/model-int8.onnx. Use model-fp32.onnx unless deployment size is a constraint.| Source language | Korean 🇰🇷 (ko) |
| Target language | English 🇬🇧 (en) |
| Architecture | MarianMT (encoder-decoder) |
| Max input tokens | 256 |
| Max output tokens | 512 |
| ONNX file size | 177 MB (fp32) / 95 MB (int8) |
| ONNX opset | 14 |
| ONNX IR version | 8 (BYOM 7.0+ compatible) |
| License | Apache-2.0 (from upstream) |
| Reference | https://huggingface.co/Helsinki-NLP/opus-mt_tiny_kor-eng |
mldb.ONNXSeq2Seq USING clause through Const_* keys: Const_min_length,
Const_max_length, Const_num_beams, Const_length_penalty,
Const_repetition_penalty. They are not fixed in the ONNX graph.
(num_return_sequences is the exception — it's baked into the graph as 1.)Note on schema name: the SQL example below usesmldb.ONNXSeq2Seq. On modern Teradata deployments BYOM is installed in thetd_mldbdatabase — adjust the schema prefix in the SQL accordingly.
1import getpass
2import teradataml as tdml
3from huggingface_hub import hf_hub_download
4
5repo_id = "Teradata/opus-mt_tiny_kor-eng"
6model_id = "opus-mt_tiny_kor-eng" # used as BYOM model_id
7
8# 1. Download artifacts from this repo
9hf_hub_download(repo_id=repo_id, filename="onnx/model-fp32.onnx", local_dir="./")
10hf_hub_download(repo_id=repo_id, filename="tokenizer.json", local_dir="./")
11
12# 2. Connect to Teradata
13tdml.create_context(
14 host=input("host: "),
15 username=input("user: "),
16 password=getpass.getpass("password: "),
17)
18
19# 3. Load model + tokenizer into BYOM tables
20tdml.save_byom(model_id=model_id, model_file="onnx/model-fp32.onnx",
21 table_name="translation_models")
22tdml.save_byom(model_id=model_id, model_file="tokenizer.json",
23 table_name="translation_tokenizers")
24
25# 4. Translate
26query = f"""
27SELECT id, sequences
28FROM mldb.ONNXSeq2Seq(
29 ON (SELECT id, txt FROM your_input_table) AS InputTable
30 ON (SELECT model_id, model FROM translation_models
31 WHERE model_id = '{model_id}') AS ModelTable DIMENSION
32 ON (SELECT model AS tokenizer FROM translation_tokenizers
33 WHERE model_id = '{model_id}') AS TokenizerTable DIMENSION
34 USING
35 Accumulate('id')
36 ModelOutputTensor('sequences')
37 SkipSpecialTokens('true')
38 OutputLength(512)
39 OverwriteCachedModel('true')
40 Const_min_length(1)
41 Const_max_length(64)
42 Const_num_beams(4)
43 Const_length_penalty(1.0)
44 Const_repetition_penalty(1.0)
45) AS t
46"""
47print(tdml.DataFrame.from_query(query))teradata-opus-translate
package, which exports the encoder/decoder, stitches in the BeamSearch op,
applies weight-only int8 quantization, and verifies parity against PyTorch on a
small sample set.Note: the same package can convert any Helsinki-NLP MarianMT model (including ones not in this collection) to a BYOM-ready ONNX bundle. If you have a translation pair that's not published here, install the package and run:python1from teradata_opus_translate import convert_model, convert_tokenizer 2 3convert_model( 4 "Helsinki-NLP/<your-model>", 5 output_path="model-fp32.onnx", 6) 7convert_tokenizer( 8 "Helsinki-NLP/<your-model>", 9 output_path="tokenizer.json", 10)The resultingmodel-fp32.onnxandtokenizer.jsonare ready to deploy with the Quickstart flow above.