VapourSynth-MLRT-TRT
This package contains the TensorRT backend implementation of the vs-mlrt plugin.
Installation
pip install vapoursynth-mlrt-trt
Building from source
Requirements
- C++ Compiler: C++20 compatible (e.g. MSVC 2019+, GCC, Clang)
- Build Tools: uv, CMake, Ninja
- Dependencies:
CUDAToolkit(nvcc, cudart, cuda_profiler_api)TensorRTSDK (including runtime, plugins, dispatch, and lean libraries)
- Environment Variables:
TENSORRT_HOME: Path to the TensorRT installation directory (must containinclude,lib, andbin).
Compilation
-
Initialize the submodule:
git submodule update --init --recursive vsmlrt/trt/vs-mlrt
-
Set the
TENSORRT_HOMEenvironment variable to point to your TensorRT installation:# Windows (PowerShell) $env:TENSORRT_HOME = "C:\Path\To\TensorRT"
# Linux export TENSORRT_HOME="/path/to/TensorRT"
-
Build the wheel:
uv build --package vapoursynth-mlrt-trt
Detailed parameter information from the parent project follows.
VapourSynth TensorRT & TensorRT-RTX
The vs-tensorrt plugin provides optimized CUDA runtime for some popular AI filters.
Usage
Prototype: core.{trt, trt_rtx}.Model(clip[] clips, string engine_path[, int[] overlap, int[] tilesize, int device_id=0, bint use_cuda_graph=False, int num_streams=1, int verbosity=2, string flexible_output_prop=""])
Arguments:
-
clip[] clips: the input clips, only 32-bit floating point RGB or GRAY clips are supported. For model specific input requirements, please consult our wiki. -
string engine_path: the path to the prebuilt engine (see below) -
int[] overlap: some networks (e.g. CNN) support arbitrary input shape where other networks might only support fixed input shape and the input clip must be processed in tiles. Theoverlapargument specifies the overlapping (horizontal and vertical, or both, in pixels) between adjacent tiles to minimize boundary issues. Please refer to network specific docs on the recommended overlapping size. -
int[] tilesize: Even for CNN where arbitrary input sizes could be supported, sometimes the network does not work well for the entire range of input dimensions, and you have to limit the size of each tile. This parameter specify the tile size (horizontal and vertical, or both, including the overlapping). Please refer to network specific docs on the recommended tile size. -
int device_id: Specifies the GPU device id to use, default 0. Requires Nvidia GPUs with second-generation Kepler architecture onwards. -
bint use_cuda_graph: whether to use CUDA Graphs to improve performance and reduce CPU overhead. -
int num_streams: number of concurrent CUDA streams to use. Default 1. Increase if GPU not saturated. -
verbosity: The verbosity level of TensorRT runtime. The message writes tostderr.0: Internal error.1: Application error.2: Warning.3: Informational messages with instructional information.4: Verbose messages with debugging information. -
string flexible_output_prop: used to support onnx models with arbitrary number of output planes.from typing import TypedDict class Output(TypedDict): clip: vs.VideoNode num_planes: int prop = "planes" # arbitrary non-empty string output = core.trt.Model(src, engine_path, flexible_output_prop=prop) # type: Output clip = output["clip"] num_planes = output["num_planes"] output_planes = [ clip.std.PropToClip(prop=f"{prop}{i}") for i in range(num_planes) ] # type: list[vs.VideoNode]
When overlap and tilesize are not specified, the filter will internally try to resize the network to fit the input clips. This might not always work (for example, the network might require the width to be divisible by 8), and the filter will error out in this case.
The general rule is to either:
- left out
overlap,tilesizeat all and just process the input frame in one tile, or - set all three so that the frame is processed in
tilesize[0]xtilesize[1]tiles, and adjacent tiles will have an overlap ofoverlap[0]xoverlap[1]pixels on each direction. The overlapped region will be throw out so that only internal output pixels are used.
Instructions for TensorRT
Build engine with dynamic shape support
- Requires models with built-in dynamic shape support, e.g.
waifu2x_v3.7zanddpir_v3.7z.
-
Build engine
trtexec --onnx=drunet_gray.onnx --minShapes=input:1x2x8x8 --optShapes=input:1x2x64x64 --maxShapes=input:1x2x1080x1920 --saveEngine=dpir_gray_1080p_dynamic.engine
The engine will be optimized for
64x64input and can be applied to eligible inputs with shape from8x8to1920x1080by specifying parametertilesizein thetrtplugin.Also check trtexec useful arguments
Run model
In vpy script:
# DPIR
src = core.std.BlankClip(src, width=640, height=360, format=vs.GRAYS)
sigma = 10.0
flt = core.trt.Model([src, core.std.BlankClip(src, color=sigma/255.0)], engine_path="dpir_gray_1080p_dynamic.engine", tilesize=[640, 360])
trtexec useful arguments
-
--workspace=N: Set workspace size in megabytes (default = 16) -
--fp16: Enable fp16 precision, in addition to fp32 (default = disabled) -
--noTF32: Disable tf32 precision (default is to enable tf32, in addition to fp32, Ampere only) -
--device=N: Select cuda device N (default = 0) -
--timingCacheFile=<file>: Save/load the serialized global timing cache -
--verbose: Use verbose logging (default = false) -
--profilingVerbosity=mode: Specify profiling verbosity.mode ::= layer_names_only|detailed|none(default = layer_names_only)
-
--tacticSources=tactics: Specify the tactics to be used by adding (+) or removing (-) tactics from the defaulttactic sources (default = all available tactics).
Note: Currently only cuDNN, cuBLAS and cuBLAS-LT are listed as optional tactics.
Tactic Sources:
tactics ::= [","tactic] tactic ::= (+|-)lib lib ::= "CUBLAS"|"CUBLAS_LT"|"CUDNN"For example, to disable cudnn and enable cublas: --tacticSources=-CUDNN,+CUBLAS
-
--useCudaGraph: Use CUDA graph to capture engine execution and then launch inference (default = disabled). This flag may be ignored if the graph capture fails. -
--noDataTransfers: Disable DMA transfers to and from device (default = enabled). -
--saveEngine=<file>: Save the serialized engine -
--loadEngine=<file>: Load a serialized engine
Instructions for TensorRT-RTX
Replace the trtexec executable by the tensorrt_rtx executable. Some options may not be supported, e.g. --fp16.
Metadata
Release files for vapoursynth-mlrt-trt 17.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vapoursynth_mlrt_trt-17.0.tar.gz | 104.3 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vapoursynth_mlrt_trt-17.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| vapoursynth_mlrt_trt-17.0-py3-none-manylinux_2_39_aarch64.whl | Python 3 | none | Linux glibc 2.39+ ARM64 | Details |
| vapoursynth_mlrt_trt-17.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 | Details |
Total release size: 877.2 kB
Release files / vapoursynth_mlrt_trt-17.0.tar.gz
| Download URL | vapoursynth_mlrt_trt-17.0.tar.gz |
|---|---|
| Size | 104.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7c58d539c5a07bb957c1d76cef7303720e614116a2642764eb20ead3592afaf
|
|
BLAKE2b-256 checksum How to use checksums |
59378bd474195c6762b513018c313084d45173d8b3258240d77d85b33d027698
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / vapoursynth_mlrt_trt-17.0-py3-none-win_amd64.whl
| Download URL | vapoursynth_mlrt_trt-17.0-py3-none-win_amd64.whl |
|---|---|
| Size | 208.3 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7cf270c26e678b84ced010462f6d1eb0facbfdfe471c275602c71f362d697aa0
|
|
BLAKE2b-256 checksum How to use checksums |
a21896660d876e557ac2981bf6d4ba4544ace1269435f774f8e6bd6b3d5f22d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / vapoursynth_mlrt_trt-17.0-py3-none-manylinux_2_39_aarch64.whl
| Download URL | vapoursynth_mlrt_trt-17.0-py3-none-manylinux_2_39_aarch64.whl |
|---|---|
| Size | 280.2 kB |
| Tags | Linux glibc 2.39+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
7b3f1cdd3e11fd4b7bbb3831542aa9c06ade2cbfd9071b3b226ea6fa225c0420
|
|
BLAKE2b-256 checksum How to use checksums |
9b5a1dd7f34a9dbef35c3dbe41c569ed8764ffbabd37da832d1625acd79b1b3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / vapoursynth_mlrt_trt-17.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | vapoursynth_mlrt_trt-17.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 284.4 kB |
| Tags | Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
6fab7d146f3c8616401ed32a159c65580b8cb318e95bbc08e237e4615d5523e4
|
|
BLAKE2b-256 checksum How to use checksums |
f2d6e03176342818f3673a1371b122816e8a82b9b0c960027c1c105612d8c59e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency log