TensorRT Guide

January 23, 2026 ยท View on GitHub

This guide helps you use TFDAT with TensorRT for accelerated video upscaling.

Vapourkit

I would recommend using Vapourkit with TFDAT, rather than the guide below. This is a nice, clean GUI that allows for easily importing and using any models made with this architecture.

Note: FP16 does not work with DirectML, you must use FP32. When using FP16 with TensorRT, import the model as FP16, then change the model configuration to FP32. This will allow it to inference properly.

Alternative Setup Process

  1. Set up VapourSynth following pifroggi's guide, sections 1 and 2
  2. Download and extract vsmlrt-windows-x64-tensorrt.[version].7z from vs-mlrt releases to your vs-plugins directory
  3. Get the model:
    • Download pre-converted ONNX from releases, or
    • Convert your own using convert_to_onnx.py (see script for detailed options)

Usage

Note: FP16 does not work with DirectML, you must use FP32. When using FP16 with TensorRT, import the model as FP16, then change the model configuration to FP32. This will allow it to inference properly.

  1. Build TensorRT engine using trtexec:

    FP16:

    trtexec --onnx="tfdat_fp16.onnx" --fp16 --optShapes=input:1x15x720x1280 --inputIOFormats=fp16:chw --outputIOFormats=fp16:chw --saveEngine=tfdat_fp16.engine --builderOptimizationLevel=5 --useCudaGraph --tacticSources=+CUDNN,-CUBLAS,-CUBLAS_LT
    

    FP32:

    trtexec --onnx="tfdat_fp32.onnx" --optShapes=input:1x15x720x1280 --saveEngine=tfdat_fp32.engine --builderOptimizationLevel=5 --useCudaGraph --tacticSources=+CUDNN,-CUBLAS,-CUBLAS_LT
    
  2. Copy vapoursynth_script.py to your VapourSynth directory, then configure it with your video path and engine path

  3. Open a Command Prompt window (NOT POWERSHELL) in your VapourSynth directory, then run a command like this. Customize the encoder settings as you wish:

vspipe -c y4m ".\vapoursynth_script.vpy" - | ffmpeg -i - -c:v hevc_nvenc -qp 0 -preset p5 -tune lossless "output.mkv"