Implementation:Triton inference server Server GenQaIdentityModels
| Knowledge Sources | |
|---|---|
| Domains | Testing, Model_Generation |
| Last Updated | 2026-02-13 17:00 GMT |
Overview
Generates identity (pass-through) test models that return their inputs unchanged, used for validating tensor handling and data type support.
Description
The `gen_qa_identity_models.py` script creates models that pass input tensors directly to outputs without any computation, serving as fundamental test fixtures for validating Triton's data path. These identity models are generated across multiple backends (TensorRT, ONNX, TensorFlow, TorchScript) and cover all supported data types including integer, float, boolean, and string types. They are heavily used by QA tests that verify correct tensor marshalling, batching behavior, data type conversions, and I/O handling without introducing computation-related variables.
Usage
Run this script to generate identity models before executing data type validation, I/O handling, or basic batching QA tests. It is one of the most commonly used model generators across the test suite.
Code Reference
Source Location
- Repository: Triton Inference Server
- File: qa/common/gen_qa_identity_models.py
- Lines: 1-1190
Signature
def create_onnx_modelfile(models_dir, model_version, max_batch, dtype, shape, input_count, output_count): ...
def create_tf_modelfile(models_dir, model_version, max_batch, dtype, shape, input_count, output_count): ...
def create_plan_modelfile(models_dir, model_version, max_batch, dtype, shape, input_count, output_count): ...
def create_modelconfig(models_dir, model_name, max_batch, dtype, shape, input_count, output_count): ...
def create_models(models_dir, dtype, shape): ...
Import
# Typically run as a standalone script
python qa/common/gen_qa_identity_models.py --models_dir /tmp/models
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| models_dir | string | Yes | Output directory for generated model repository |
| dtype | string | No | Data type for identity tensors (e.g., TYPE_FP32, TYPE_STRING) |
| shape | list[int] | No | Tensor shape for model inputs and outputs |
| input_count | int | No | Number of input tensors per model |
| output_count | int | No | Number of output tensors per model |
Outputs
| Name | Type | Description |
|---|---|---|
| model_repository | directory | Model directories per backend with versioned model files |
| config.pbtxt | file | Model configuration mapping inputs directly to outputs |
| model files | file | Backend-specific model files implementing identity pass-through |
Usage Examples
Generate Identity Models
python qa/common/gen_qa_identity_models.py \
--models_dir /tmp/identity_models
Generate for Specific Data Types
python qa/common/gen_qa_identity_models.py \
--models_dir /tmp/identity_models \
--dtype TYPE_FP32 TYPE_INT32 TYPE_STRING