ONNXSeq2Seq | Supported External Model Types | Teradata Package for Python - ONNXSeq2Seq - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Published
March 2025
ft:locale
en-US
ft:lastEdition
2025-12-05
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

ONNXSeq2Seq applies a sequence-to-sequence model that has been created outside Vantage and exported to Vantage in ONNX format to input data within Vantage.

Required Parameters

newdata
Specifies the input teradataml DataFrame that contains the data to be scored.
modeldata
Specifies the model teradataml DataFrame to be used for scoring.

Use 'retrieve_byom() to get the teradataml DataFrame that contains the model.

tokenizerdata
Specifies the tokenizer teradataml DataFrame that contains the tokenizer json file.
accumulate
Specifies the names of input teradataml DataFrame columns to copy to the output. By default, the function copies all input teradataml DataFrame columns to the output.
model_output_tensor
Specifies the column of the model's possible output fields you want to calculate and output.

Optional Parameters

encode_max_length
Specifies the maximum length of the tokenizer output token encodings (only applies for models with symbolic dimensions).

Default value: 512

show_model_properties
Specifies the default or expanded "model_input_fields_map" based on input model for defaults or "model_input_fields_map" for expansion.

Default value: False

output_length
Specifies the output length for the model sequence output, in number of characters for the VARCHAR output. If the value exceeds the maximum Unicode VARCHAR size of 32000, a CLOB is created automatically.

Default value: 1000

overwrite_cached_models
Specifies the model name that needs to be removed from the cache. When a model loaded into the memory of the node fits in the cache, it stays in the cache until being evicted to make space for another model that needs to be loaded. Therefore, a model can remain in the cache even after the completion of function execution. Other functions that use the same model can use it, saving the cost of reloading it into memory. User should overwrite a cached model only when it is updated, to make sure that the Predict function uses the updated model instead of the cached model.
Do not use the "overwrite_cached_models" argument except when you try to replace a previously cached model. Using the argument in other cases, including in concurrent queries or multiple times within a short period of time lead to an OOM error.

Default value: "false"

Permitted values: true, t, yes, y, 1, false, f, no, n, 0, *, current_cached_model

is_debug
Specifies whether debug statements are added to a trace table or not.

When set to True, debug statements are added to a trace table that must be created beforehand.

  • Only available with BYOM version 3.00.00.02 and later.
  • To save logs for debugging, create an error log by using the is_debug=True parameter in the predict functions.

    Use a database trace table to collect information that impacts performance of the function; Teradata recommends using small data input sizes.

  • To generate this log, user must do the following:
    1. Create a global trace table with columns vproc_ID BYTE(2), Sequence INTEGER, Trace_Output VARCHAR(31000).
    2. Turn on session function tracing:
      SET SESSION FUNCTION TRACE USING '' FOR TABLE <trace_table_name_created_in_step_1>;
    3. Execute function with "is_debug" set to True.
    4. Debug information is logged to the table created in step 1.
    5. To turn off the logging, either disconnect from the session or run following SQL:
      SET SESSION FUNCTION TRACE OFF;

    The trace table is temporary and the information is deleted if you log off from the session. If long-term persistence is necessary, copy the table to a permanent table before leaving the session.

Default value: False

enable_memory_check
Specifies whether there is enough native memory for large models.

Default value: True

skip_special_tokens
Specifies whether to skip special tokens in the output.

Default value: True

const_*
Specifies the constant value to be used as a model input by using the argument name const_<field_name>. Providing constant values as parameters reduces system overhead, since the value will not be added to every row being scored.

Generic Parameters

Us this function to partition, hash, order or local order the input data. These generic arguments are available for each argument that accepts teradataml DataFrame as input and can be accessed as:
  • "<input_data_arg_name>_partition_column" accepts str or list of str (Strings) or PartitionKind
  • "<input_data_arg_name>_hash_column" accepts str or list of str (Strings)
  • "<input_data_arg_name>_order_column" accepts str or list of str (Strings)
  • "local_order_<input_data_arg_name>" accepts boolean

These generic arguments are supported by teradataml if the underlying database function supports, else an exception is raised.

persist
Specifies whether to persist the results of the function in a table or not. When set to True, results are persisted in a table; otherwise, results are garbage collected at the end of the session.

Default value: False

volatile
Specifies whether to put the results of the function in a volatile table or not. When set to True, results are stored in a volatile table, otherwise not.

Default value: False