From f75d6b13e7db59b97550a87df03d9af98d8b6498 Mon Sep 17 00:00:00 2001 From: Qikai Li Date: Wed, 18 Nov 2026 06:48:34 +0000 Subject: [PATCH] feat(videomae): add VideoMAE masked video reconstruction family Add the videomae family for MCG-NJU/videomae-base (VideoMAEForPreTraining) on the masked_video_text_to_video Task, the first family bound to it. - Builder: one float32 engine (TF32 off) with the Conv3d tubelet embedding, the encoder on the visible tubes only, and the decoder on the visible tubes followed by one mask token per masked tube, as in transformers. Dimensions come from config.json; the name, dtype and shape of every checkpoint tensor are checked against them from the safetensors header before the weights are read. Flags that change the computation, values that do not hold in float32 and processors that would resize or crop a clip of the model's size are refused. - Runtime: IModel and IMaskedVideoTextToVideo. It checks runtime.json and the engine's inputs, outputs and profile at load, and the request (the model's frame count and frame size, 8-bit or float32 RGB, masks of whole tubes, an empty prompt, no Config). It normalizes like the checkpoint's processor and restores each masked tube with the tube's source mean and standard deviation (the checkpoint predicts tube-normalized pixels), clamped to [0, 1]. Conditioning tubes keep their source pixels; the source timeline is returned. - Tests: configuration, request and checkpoint checks, the sinusoid table, a C++ test of the tube layout, the reconstruction and the bundle checks, GPU parity of the engine logits with transformers on small random checkpoints, C and C++ SDK consumers, and the E2E against the reference reconstruction with a tube mask and a box mask. An E2E selection that names the family but matches none of its cases fails. - NOTICE for the transformers code it follows, installed with the library, and the copied test photograph in ASSET_LICENSES.md. Signed-off-by: Qikai Li --- ASSET_LICENSES.md | 2 + families/videomae/NOTICE | 18 + families/videomae/README.md | 66 +++ families/videomae/__init__.py | 4 + families/videomae/config.py | 235 +++++++++ families/videomae/graph.py | 160 ++++++ families/videomae/model.py | 280 +++++++++++ families/videomae/runtime/CMakeLists.txt | 76 +++ families/videomae/runtime/bundle_config.cpp | 141 ++++++ families/videomae/runtime/bundle_config.h | 30 ++ families/videomae/runtime/clip.cpp | 203 ++++++++ families/videomae/runtime/clip.h | 70 +++ families/videomae/runtime/pipeline.cpp | 92 ++++ families/videomae/runtime/pipeline.h | 40 ++ families/videomae/runtime/plugin.cpp | 40 ++ families/videomae/support.py | 15 + families/videomae/tests/__init__.py | 4 + families/videomae/tests/cpp/test_clip.cpp | 438 ++++++++++++++++ families/videomae/tests/data/test_img.jpeg | Bin 0 -> 55258 bytes .../tests/manifests/videomae-base.json | 24 + families/videomae/tests/sdk_consumer.c | 241 +++++++++ families/videomae/tests/sdk_consumer.cpp | 168 +++++++ families/videomae/tests/test_e2e.py | 455 +++++++++++++++++ families/videomae/tests/test_model.py | 469 ++++++++++++++++++ families/videomae/tests/test_support.py | 26 + 25 files changed, 3297 insertions(+) create mode 100644 families/videomae/NOTICE create mode 100644 families/videomae/README.md create mode 100644 families/videomae/__init__.py create mode 100644 families/videomae/config.py create mode 100644 families/videomae/graph.py create mode 100644 families/videomae/model.py create mode 100644 families/videomae/runtime/CMakeLists.txt create mode 100644 families/videomae/runtime/bundle_config.cpp create mode 100644 families/videomae/runtime/bundle_config.h create mode 100644 families/videomae/runtime/clip.cpp create mode 100644 families/videomae/runtime/clip.h create mode 100644 families/videomae/runtime/pipeline.cpp create mode 100644 families/videomae/runtime/pipeline.h create mode 100644 families/videomae/runtime/plugin.cpp create mode 100644 families/videomae/support.py create mode 100644 families/videomae/tests/__init__.py create mode 100644 families/videomae/tests/cpp/test_clip.cpp create mode 100644 families/videomae/tests/data/test_img.jpeg create mode 100644 families/videomae/tests/manifests/videomae-base.json create mode 100644 families/videomae/tests/sdk_consumer.c create mode 100644 families/videomae/tests/sdk_consumer.cpp create mode 100644 families/videomae/tests/test_e2e.py create mode 100644 families/videomae/tests/test_model.py create mode 100644 families/videomae/tests/test_support.py diff --git a/ASSET_LICENSES.md b/ASSET_LICENSES.md index 1cf7523817..c00403a82f 100644 --- a/ASSET_LICENSES.md +++ b/ASSET_LICENSES.md @@ -59,6 +59,8 @@ inclusion and redistribution in this repository under the Apache License 2.0: - `families/timm_resnet/tests/data/test_img.jpeg` - `families/timm_vgg/tests/data/test_img.jpeg` - `families/timm_vit/tests/data/test_img.jpeg` +- `families/videomae/tests/data/test_img.jpeg` (the E2E cuts a 16-frame + camera pan of 224x224 crops from it) `families/gemma3n/tests/data/test_img_car.jpeg` is a byte-identical copy of `families/timm_resnet/tests/data/test_img_car.jpeg`, a crop of the same diff --git a/families/videomae/NOTICE b/families/videomae/NOTICE new file mode 100644 index 0000000000..f30ad99165 --- /dev/null +++ b/families/videomae/NOTICE @@ -0,0 +1,18 @@ +VideoMAE base checkpoint (not part of this repository; the E2E reads the pinned revision +from the Hugging Face cache): +https://huggingface.co/MCG-NJU/videomae-base +Revision dc740ceda42fce44faed2ea03c6d447db72f6af9 +Licensed under the Creative Commons Attribution-NonCommercial 4.0 International +License (CC BY-NC 4.0) by the Multimedia Computing Group, Nanjing University. + +The network in model.py and graph.py follows VideoMAEForPreTraining, and +sinusoid_table in graph.py reproduces get_sinusoid_encoding_table, of the VideoMAE +implementation in Hugging Face Transformers 5.2.0 +(src/transformers/models/videomae/modeling_videomae.py): +https://github.com/huggingface/transformers/tree/v5.2.0 +Copyright 2022 Multimedia Computing Group, Nanjing University and The HuggingFace Inc. team. +Licensed under Apache License 2.0. + +The restoration of predicted tubes in runtime/clip.cpp applies the method of the +VideoMAE authors' visualization script, run_videomae_vis.py, without its code: +https://github.com/MCG-NJU/VideoMAE/tree/14ef8d856287c94ef1f985fe30f958eb4ec2c55d diff --git a/families/videomae/README.md b/families/videomae/README.md new file mode 100644 index 0000000000..6326370ea8 --- /dev/null +++ b/families/videomae/README.md @@ -0,0 +1,66 @@ +# VideoMAE + +This family builds the transformers VideoMAE pre-training model +(`VideoMAEForPreTraining`, `MCG-NJU/videomae-base` in the manifest) as one +float32 TensorRT engine for the `masked_video_text_to_video` Task: it +reconstructs the masked tubes of a clip from the visible ones. Batch is 1. +Precision is fp32, the checkpoint's own; other precisions and quantization are +refused. + +The engine runs the model as the reference does: the tubelet embedding of the +whole clip, the encoder on the visible tubes only, then the decoder on the +visible tubes followed by one mask token per masked tube, and the pixel head +on the masked tubes. + +## Request + +- `source`: exactly the checkpoint's `num_frames` RGB frames of `image_size` x + `image_size` pixels (16 frames of 224 x 224 for `videomae-base`), 8-bit or + float32 in [0, 1]. The family does not resample: resize and center-crop the + frames the way the checkpoint's processor does first. Timestamps are + optional and are returned unchanged. +- `mask`: one value per source pixel, 1 where the model reconstructs and 0 + where the source conditions it. VideoMAE works on tubes of `tubelet_size` + frames x `patch_size` x `patch_size` pixels (2 x 16 x 16 here), so each tube + must be all 0 or all 1, and at least one tube of each kind is required. Soft + mask values are refused. +- `prompt`: must be empty; the model has no text condition. +- There are no runtime Config fields. + +## Result + +One float32 RGB frame in [0, 1] per source frame, with the source timeline and +no context prefix. Conditioning tubes keep their source pixels exactly. + +The checkpoint predicts each masked tube normalized by that tube's own +per-channel mean and unbiased standard deviation (`norm_pix_loss`). Like the +authors' visualization (`run_videomae_vis.py` in +[MCG-NJU/VideoMAE](https://github.com/MCG-NJU/VideoMAE)), the family restores +those statistics from the tube's source pixels (prediction x (std + 1e-6) + +mean) and clamps the result to [0, 1]. The source therefore has to hold the +clip's real pixels under the mask as well: the mask selects which tubes the +model re-creates, and the brightness and contrast of each re-created tube still +come from the source. + +## Native API + +The shared CLI has no command for this Task. Use the C or C++ SDK +(`trtmc::MaskedVideoTextToVideo`); `tests/sdk_consumer.c` and +`tests/sdk_consumer.cpp` are complete examples. + +## Not supported + +- `VideoMAEForVideoClassification` and `VideoMAEModel` checkpoints: they have no + pixel decoder, and the shared SDK has no video classification or video + feature Task. They are not claimed by this family. +- Checkpoints whose targets are not normalized per tube (`norm_pix_loss` false), + or with another activation, without the q and v biases, or with other than + three channels. +- Other clip lengths or frame sizes than the checkpoint's, batches, and + precisions other than fp32. + +## Checkpoint license and sources + +`MCG-NJU/videomae-base` is published under CC BY-NC 4.0 (non-commercial use); the +repository does not include its weights. Sources of the network and of the +reconstruction method are listed in `NOTICE`. diff --git a/families/videomae/__init__.py b/families/videomae/__init__.py new file mode 100644 index 0000000000..9f29a32085 --- /dev/null +++ b/families/videomae/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""VideoMAE masked video reconstruction family.""" diff --git a/families/videomae/config.py b/families/videomae/config.py new file mode 100644 index 0000000000..b5a356f01f --- /dev/null +++ b/families/videomae/config.py @@ -0,0 +1,235 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Model and processor configuration of a VideoMAE pre-training checkpoint. + +Dimensions come from ``config.json``, with the defaults of transformers' +``VideoMAEConfig`` for keys a file omits. Flags that change what the network +computes are accepted only at the values this family reproduces. + +The runtime takes clips that already have the model's frame count and frame +size, so the processor must leave such a clip unchanged apart from rescaling +and normalization: its resize and center crop have to be the identity at that +size. ``preprocessor_config.json`` is read with the defaults of +``VideoMAEImageProcessor``. +""" + +from __future__ import annotations + +import json +import math +from pathlib import Path + +import numpy as np + +ARCHITECTURE = "VideoMAEForPreTraining" + +# VideoMAEConfig defaults (transformers 5.2.0) for keys a config.json omits. +_MODEL_DEFAULTS = { + "image_size": 224, + "patch_size": 16, + "num_channels": 3, + "num_frames": 16, + "tubelet_size": 2, + "hidden_size": 768, + "num_hidden_layers": 12, + "num_attention_heads": 12, + "intermediate_size": 3072, + "hidden_act": "gelu", + "layer_norm_eps": 1e-12, + "qkv_bias": True, + "use_mean_pooling": True, + "decoder_num_attention_heads": 6, + "decoder_hidden_size": 384, + "decoder_num_hidden_layers": 4, + "decoder_intermediate_size": 1536, + "norm_pix_loss": True, +} + +# VideoMAEImageProcessor defaults (transformers 5.2.0) for keys a +# preprocessor_config.json omits. +_PROCESSOR_DEFAULTS = { + "do_resize": True, + "size": {"shortest_edge": 224}, + "do_center_crop": True, + "crop_size": {"height": 224, "width": 224}, + "do_rescale": True, + "rescale_factor": 1 / 255, + "do_normalize": True, + "image_mean": [0.5, 0.5, 0.5], + "image_std": [0.5, 0.5, 0.5], +} + + +def _object_without_repeated_keys(pairs: list) -> dict: + keys = [key for key, _ in pairs] + repeated = sorted({key for key in keys if keys.count(key) > 1}) + if repeated: + raise ValueError(f"videomae refuses repeated JSON keys: {', '.join(repeated)}") + return dict(pairs) + + +def _read_object(path: Path) -> dict: + if not path.is_file(): + raise FileNotFoundError(f"videomae checkpoint file is missing: {path}") + value = json.loads(path.read_text(encoding="utf-8"), + object_pairs_hook=_object_without_repeated_keys) + if not isinstance(value, dict): + raise ValueError(f"videomae expects a JSON object in {path}") + return value + + +def _number(value) -> bool: + """A finite JSON number; booleans and null are not numbers.""" + return (not isinstance(value, bool) and isinstance(value, (int, float)) + and math.isfinite(value)) + + +def _positive_int(value, name: str) -> int: + if isinstance(value, bool) or not isinstance(value, int) or value <= 0: + raise ValueError(f"videomae config.json needs a positive integer {name}; got {value!r}") + return value + + +def _square(value, name: str) -> int: + """``image_size`` and ``patch_size`` may be an int or a pair; the family needs a square.""" + if isinstance(value, list): + if len(value) != 2: + raise ValueError(f"videomae config.json needs one or two values for {name}; got {value!r}") + height, width = (_positive_int(item, name) for item in value) + if height != width: + raise NotImplementedError(f"videomae needs a square {name}; got {value!r}") + return height + return _positive_int(value, name) + + +def _expect(config: dict, key: str, expected) -> None: + value = config[key] + if value != expected or type(value) is not type(expected): + raise NotImplementedError( + f"videomae reproduces {key}={expected!r}; this checkpoint has {value!r}") + + +def _model(path: Path) -> dict: + raw = _read_object(path) + architectures = raw.get("architectures") + if (raw.get("model_type") != "videomae" or not isinstance(architectures, list) + or ARCHITECTURE not in architectures): + raise ValueError(f"videomae builds {ARCHITECTURE} checkpoints only: {path}") + config = {**_MODEL_DEFAULTS, **raw} + # Pixel targets normalized per tube (the reconstruction the runtime inverts), + # RGB frames, the exact error-function GELU, q and v biases (k has none). + _expect(config, "norm_pix_loss", True) + _expect(config, "num_channels", 3) + _expect(config, "hidden_act", "gelu") + _expect(config, "qkv_bias", True) + if not isinstance(config["use_mean_pooling"], bool): + raise ValueError("videomae config.json needs a boolean use_mean_pooling") + + image_size = _square(config["image_size"], "image_size") + patch_size = _square(config["patch_size"], "patch_size") + num_frames = _positive_int(config["num_frames"], "num_frames") + tubelet = _positive_int(config["tubelet_size"], "tubelet_size") + if image_size % patch_size or num_frames % tubelet: + raise ValueError("videomae needs frames and frame size divisible into whole tubes") + grid = image_size // patch_size + tubes = num_frames // tubelet * grid * grid + if tubes < 2 or tubelet * patch_size * patch_size < 2: + raise ValueError("videomae needs at least two tubes of at least two pixels") + + widths = {} + for prefix in ("", "decoder_"): + width = _positive_int(config[f"{prefix}hidden_size"], f"{prefix}hidden_size") + heads = _positive_int(config[f"{prefix}num_attention_heads"], + f"{prefix}num_attention_heads") + if width % heads: + raise ValueError(f"videomae {prefix}hidden_size is not a multiple of its head count") + widths[prefix] = { + "width": width, + "heads": heads, + "layers": _positive_int(config[f"{prefix}num_hidden_layers"], + f"{prefix}num_hidden_layers"), + "intermediate": _positive_int(config[f"{prefix}intermediate_size"], + f"{prefix}intermediate_size"), + } + eps = config["layer_norm_eps"] + # The graph adds it in float32: it must stay positive and finite there. + with np.errstate(over="ignore"): + if not _number(eps) or not 0.0 < np.float32(eps) < np.inf: + raise ValueError(f"videomae config.json needs a positive float32 layer_norm_eps; got {eps!r}") + + return { + "image_size": image_size, + "patch_size": patch_size, + "num_frames": num_frames, + "tubelet_size": tubelet, + "grid": grid, + "tubes": tubes, + "tube_values": tubelet * patch_size * patch_size * 3, + "encoder": widths[""], + "decoder": widths["decoder_"], + "layer_norm_eps": float(eps), + "final_layernorm": not config["use_mean_pooling"], + } + + +def _size(value, *, default_to_square: bool) -> dict: + if isinstance(value, int) and not isinstance(value, bool): + return {"height": value, "width": value} if default_to_square else {"shortest_edge": value} + if isinstance(value, dict) and all( + isinstance(item, int) and not isinstance(item, bool) for item in value.values()): + return dict(value) + raise ValueError(f"videomae cannot read the processor size {value!r}") + + +def _flag(processor: dict, key: str) -> bool: + value = processor[key] + if not isinstance(value, bool): + raise ValueError(f"videomae needs a boolean {key} in preprocessor_config.json; got {value!r}") + return value + + +def _processor(path: Path, image_size: int) -> dict: + processor = {**_PROCESSOR_DEFAULTS, **_read_object(path)} + square = {"height": image_size, "width": image_size} + if _flag(processor, "do_resize"): + size = _size(processor["size"], default_to_square=False) + if size not in ({"shortest_edge": image_size}, square): + raise NotImplementedError( + f"videomae needs a processor that keeps {image_size}x{image_size} frames; " + f"its resize is {size!r}") + if _flag(processor, "do_center_crop"): + crop = _size(processor["crop_size"], default_to_square=True) + if crop != square: + raise NotImplementedError( + f"videomae needs a processor that keeps {image_size}x{image_size} frames; " + f"its center crop is {crop!r}") + factor = processor["rescale_factor"] + if not _number(factor): + raise ValueError(f"videomae needs a numeric rescale_factor; got {factor!r}") + if not _flag(processor, "do_rescale") or not math.isclose(factor, 1 / 255, rel_tol=0.0, + abs_tol=1e-12): + raise NotImplementedError("videomae reproduces the 1/255 rescale of 8-bit frames only") + if not _flag(processor, "do_normalize"): + raise NotImplementedError("videomae reproduces a normalizing processor only") + mean, std = processor["image_mean"], processor["image_std"] + if (not isinstance(mean, list) or not isinstance(std, list) or len(mean) != 3 or len(std) != 3 + or not all(_number(value) for value in mean + std) or min(std) <= 0): + raise ValueError("videomae needs three finite image_mean values and three positive image_std values") + # The runtime normalizes in float32, (pixel - mean) / std, for pixels in [0, 1]. + with np.errstate(over="ignore", divide="ignore", invalid="ignore"): + mean32, std32 = np.float32(mean), np.float32(std) + normalized = (np.float32([[0.0], [1.0]]) - mean32) / std32 + if not (np.isfinite(mean32).all() and np.isfinite(std32).all() and (std32 > 0).all() + and np.isfinite(normalized).all()): + raise ValueError("videomae needs image statistics that keep normalized pixels finite in float32") + return {"image_mean": [float(value) for value in mean], + "image_std": [float(value) for value in std]} + + +def resolve(model_dir: Path) -> dict: + """Return the network dimensions and the processor statistics of one checkpoint.""" + model_dir = Path(model_dir) + config = _model(model_dir / "config.json") + config.update(_processor(model_dir / "preprocessor_config.json", config["image_size"])) + return config diff --git a/families/videomae/graph.py b/families/videomae/graph.py new file mode 100644 index 0000000000..3b885a086e --- /dev/null +++ b/families/videomae/graph.py @@ -0,0 +1,160 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""TensorRT graph of ``VideoMAEForPreTraining``. + +Rows are ``[1, sequence, width]`` tensors. The encoder sequence is the number +of visible tubes and the decoder sequence the number of all tubes, so both are +only known at run time and every reshape keeps the sequence axis symbolic. + +The transformer layers are pre-norm with a residual after attention and after +the MLP; attention projects queries and values with a bias and keys without +one; the activation is the exact error-function GELU (``hidden_act: gelu``). +""" + +from __future__ import annotations + +import numpy as np +import tensorrt as trt + + +def constant(network, values, dtype=np.float32): + data = np.ascontiguousarray(np.asarray(values, dtype=dtype)) + return network.add_constant(data.shape, data).get_output(0) + + +def _binary(network, left, right, operation): + return network.add_elementwise(left, right, operation).get_output(0) + + +def add(network, left, right): + return _binary(network, left, right, trt.ElementWiseOperation.SUM) + + +def _multiply(network, left, right): + return _binary(network, left, right, trt.ElementWiseOperation.PROD) + + +def layer_norm(network, rows, gamma, beta, eps): + """LayerNorm over the last axis with the biased variance, as ``torch.nn.LayerNorm``.""" + axis = 1 << (len(rows.shape) - 1) + ones = (1,) * (len(rows.shape) - 1) + mean = network.add_reduce(rows, trt.ReduceOperation.AVG, axis, True).get_output(0) + centred = _binary(network, rows, mean, trt.ElementWiseOperation.SUB) + variance = network.add_reduce(_multiply(network, centred, centred), trt.ReduceOperation.AVG, + axis, True).get_output(0) + shifted = add(network, variance, constant(network, np.full(ones + (1,), eps))) + deviation = network.add_unary(shifted, trt.UnaryOperation.SQRT).get_output(0) + normed = _binary(network, centred, deviation, trt.ElementWiseOperation.DIV) + width = int(np.asarray(gamma).size) + scaled = _multiply(network, normed, + constant(network, np.asarray(gamma).reshape(ones + (width,)))) + return add(network, scaled, constant(network, np.asarray(beta).reshape(ones + (width,)))) + + +def linear(network, rows, weight, bias=None): + """``rows @ weight.T + bias`` with ``torch.nn.Linear``'s ``[out, in]`` weight layout.""" + weight = np.asarray(weight, dtype=np.float32) + batch = (1,) * (len(rows.shape) - 2) + product = network.add_matrix_multiply( + rows, trt.MatrixOperation.NONE, + constant(network, weight.reshape(batch + weight.shape)), trt.MatrixOperation.TRANSPOSE, + ).get_output(0) + if bias is None: + return product + bias = np.asarray(bias, dtype=np.float32) + return add(network, product, constant(network, bias.reshape(batch + (1, bias.size)))) + + +def gelu(network, rows): + """``0.5 * x * (1 + erf(x / sqrt(2)))``, spelled out so the tanh form cannot be chosen.""" + ones = (1,) * len(rows.shape) + + def scalar(value): + return constant(network, np.full(ones, value)) + + erf = network.add_unary(_multiply(network, rows, scalar(1.0 / np.sqrt(2.0))), + trt.UnaryOperation.ERF).get_output(0) + return _multiply(network, _multiply(network, scalar(0.5), rows), add(network, scalar(1.0), erf)) + + +def _heads(network, rows, heads, head_dim): + """``[1, S, H * D] -> [1, H, S, D]``; 0 copies the symbolic sequence length.""" + layer = network.add_shuffle(rows) + layer.reshape_dims = (0, 0, heads, head_dim) + layer.second_transpose = (0, 2, 1, 3) + return layer.get_output(0) + + +def attention(network, rows, weights, prefix, heads): + """Self-attention of ``VideoMAESelfAttention`` plus its output projection.""" + width = int(rows.shape[-1]) + head_dim = width // heads + attention_prefix = prefix + "attention.attention." + query = linear(network, rows, weights[attention_prefix + "query.weight"], + weights[attention_prefix + "q_bias"]) + key = linear(network, rows, weights[attention_prefix + "key.weight"]) + value = linear(network, rows, weights[attention_prefix + "value.weight"], + weights[attention_prefix + "v_bias"]) + scores = network.add_matrix_multiply( + _heads(network, query, heads, head_dim), trt.MatrixOperation.NONE, + _heads(network, key, heads, head_dim), trt.MatrixOperation.TRANSPOSE).get_output(0) + scores = _multiply(network, scores, constant(network, np.full((1, 1, 1, 1), head_dim**-0.5))) + probabilities = network.add_softmax(scores) + probabilities.axes = 1 << 3 + context = network.add_matrix_multiply( + probabilities.get_output(0), trt.MatrixOperation.NONE, + _heads(network, value, heads, head_dim), trt.MatrixOperation.NONE).get_output(0) + merged = network.add_shuffle(context) + merged.first_transpose = (0, 2, 1, 3) + merged.reshape_dims = (0, 0, width) + return linear(network, merged.get_output(0), weights[prefix + "attention.output.dense.weight"], + weights[prefix + "attention.output.dense.bias"]) + + +def transformer_layer(network, rows, weights, prefix, heads, eps): + """One ``VideoMAELayer``: pre-norm attention and MLP, each added back to its input.""" + normed = layer_norm(network, rows, weights[prefix + "layernorm_before.weight"], + weights[prefix + "layernorm_before.bias"], eps) + rows = add(network, attention(network, normed, weights, prefix, heads), rows) + normed = layer_norm(network, rows, weights[prefix + "layernorm_after.weight"], + weights[prefix + "layernorm_after.bias"], eps) + hidden = gelu(network, linear(network, normed, weights[prefix + "intermediate.dense.weight"], + weights[prefix + "intermediate.dense.bias"])) + return add(network, linear(network, hidden, weights[prefix + "output.dense.weight"], + weights[prefix + "output.dense.bias"]), rows) + + +def sinusoid_table(positions: int, width: int) -> np.ndarray: + """The fixed position table of the reference, computed in float64 and stored as float32. + + Reproduces ``get_sinusoid_encoding_table`` of Hugging Face Transformers 5.2.0 + (Apache-2.0; see NOTICE) operation for operation, so the float32 values match + the reference bit for bit. + """ + + def angles(position): + return [position / np.power(10000, 2 * (index // 2) / width) for index in range(width)] + + table = np.array([angles(position) for position in range(positions)]) + table[:, 0::2] = np.sin(table[:, 0::2]) + table[:, 1::2] = np.cos(table[:, 1::2]) + return table.astype(np.float32) + + +def last_rows(network, rows, skipped, kept, width): + """``rows[:, -len(kept):]`` where the first ``len(skipped)`` rows are dropped.""" + + def lengths(*parts): + layer = network.add_concatenation(list(parts)) + layer.axis = 0 + return layer.get_output(0) + + skipped_count = network.add_shape(skipped).get_output(0) + kept_count = network.add_shape(kept).get_output(0) + zero = constant(network, [0], np.int64) + layer = network.add_slice(rows, (0, 0, 0), (1, 1, width), (1, 1, 1)) + layer.set_input(1, lengths(zero, skipped_count, zero)) + layer.set_input(2, lengths(constant(network, [1], np.int64), kept_count, + constant(network, [width], np.int64))) + return layer.get_output(0) diff --git a/families/videomae/model.py b/families/videomae/model.py new file mode 100644 index 0000000000..862aff8696 --- /dev/null +++ b/families/videomae/model.py @@ -0,0 +1,280 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Build a VideoMAE masked-video bundle. + +One float32 engine runs ``VideoMAEForPreTraining`` for one clip: + +- ``pixel_values`` ``[1, frames, 3, size, size]``: the clip after the + checkpoint's rescale and normalization; +- ``visible_index`` ``[V]`` and ``masked_index`` ``[M]``: the ascending tube + numbers that condition the reconstruction and the ones to reconstruct, with + ``V + M`` the number of tubes; +- ``logits`` ``[1, M, tubelet * patch * patch * 3]``: the prediction of each + masked tube in its own normalization (``norm_pix_loss``), its values in + (frame, row, column, channel) order. + +The tubelet embedding is applied to the whole clip, the encoder sees only the +visible tubes, and the decoder sees the visible tubes followed by one mask +token per masked tube, as in the reference. Turning predictions back into +pixels is the runtime's job (``runtime/clip.cpp``). +""" + +from __future__ import annotations + +from pathlib import Path + +import numpy as np +import tensorrt as trt + +from . import config as config_module, graph as g + +_TASK = "masked_video_text_to_video" +# The masking ratio of the checkpoint's pre-training (90 % of the tubes, the +# same spatial pattern in every tubelet); it only sets the shapes the engine +# is tuned for, every split of the tubes runs. +_TUNED_MASK_RATIO = 0.9 + + +def _open_checkpoint(model_dir: Path, cfg: dict) -> dict: + """Load the safetensors checkpoint this family publishes, once the name, dtype and shape + of every tensor in its header match the configuration.""" + try: + import safetensors + except ImportError as error: + raise RuntimeError("videomae requires safetensors in the build environment") from error + + path = Path(model_dir) / "model.safetensors" + if not path.is_file(): + raise FileNotFoundError(f"Required safetensors checkpoint is missing: {path}") + with safetensors.safe_open(str(path), framework="np") as handle: + header = {} + for key in handle.keys(): + tensor = handle.get_slice(key) + header[key] = (tensor.get_dtype(), tuple(tensor.get_shape())) + _require_tensors(header, cfg) + return {key: handle.get_tensor(key) for key in header} + + +def _layer_shapes(prefix: str, width: int, intermediate: int) -> dict[str, tuple[int, ...]]: + """The tensors of one ``VideoMAELayer`` and their exact shapes.""" + return {prefix + name: shape for name, shape in ( + ("attention.attention.query.weight", (width, width)), + ("attention.attention.q_bias", (width,)), + ("attention.attention.key.weight", (width, width)), + ("attention.attention.value.weight", (width, width)), + ("attention.attention.v_bias", (width,)), + ("attention.output.dense.weight", (width, width)), + ("attention.output.dense.bias", (width,)), + ("intermediate.dense.weight", (intermediate, width)), + ("intermediate.dense.bias", (intermediate,)), + ("output.dense.weight", (width, intermediate)), + ("output.dense.bias", (width,)), + ("layernorm_before.weight", (width,)), + ("layernorm_before.bias", (width,)), + ("layernorm_after.weight", (width,)), + ("layernorm_after.bias", (width,)), + )} + + +def _expected_shapes(cfg: dict) -> dict[str, tuple[int, ...]]: + """Every tensor the family runs, with the exact shape the configuration implies.""" + encoder, decoder = cfg["encoder"], cfg["decoder"] + width, decoder_width = encoder["width"], decoder["width"] + shapes = { + "videomae.embeddings.patch_embeddings.projection.weight": + (width, 3, cfg["tubelet_size"], cfg["patch_size"], cfg["patch_size"]), + "videomae.embeddings.patch_embeddings.projection.bias": (width,), + "encoder_to_decoder.weight": (decoder_width, width), + "mask_token": (1, 1, decoder_width), + "decoder.norm.weight": (decoder_width,), + "decoder.norm.bias": (decoder_width,), + "decoder.head.weight": (cfg["tube_values"], decoder_width), + "decoder.head.bias": (cfg["tube_values"],), + } + if cfg["final_layernorm"]: + shapes["videomae.layernorm.weight"] = (width,) + shapes["videomae.layernorm.bias"] = (width,) + for index in range(encoder["layers"]): + shapes.update(_layer_shapes(f"videomae.encoder.layer.{index}.", width, + encoder["intermediate"])) + for index in range(decoder["layers"]): + shapes.update(_layer_shapes(f"decoder.decoder_layers.{index}.", decoder_width, + decoder["intermediate"])) + return shapes + + +def _require_tensors(tensors: dict[str, tuple[str, tuple[int, ...]]], cfg: dict) -> None: + """Check each tensor's name, safetensors dtype code and shape against the configuration.""" + shapes = _expected_shapes(cfg) + missing = [key for key in shapes if key not in tensors] + if missing: + raise KeyError("videomae checkpoint is missing expected tensors: " + ", ".join(missing)) + unexpected = sorted(set(tensors) - set(shapes)) + if unexpected: + raise KeyError("videomae checkpoint has tensors this family does not run: " + + ", ".join(unexpected[:8])) + not_float32 = sorted(key for key in shapes if tensors[key][0] != "F32") + if not_float32: + raise TypeError("videomae builds float32 checkpoints only: " + ", ".join(not_float32[:8])) + for key, shape in shapes.items(): + if tensors[key][1] != shape: + raise ValueError(f"videomae tensor {key} has shape {tensors[key][1]}, expected {shape}") + + +def _require_weights(weights: dict, cfg: dict) -> None: + """The same checks for tensors already in memory.""" + _require_tensors({key: ("F32" if value.dtype == np.float32 else str(value.dtype), + tuple(value.shape)) for key, value in weights.items()}, cfg) + + +def _builder(verbose: bool): + logger = trt.Logger(trt.Logger.VERBOSE if verbose else trt.Logger.WARNING) + builder = trt.Builder(logger) + network = builder.create_network(1 << int(trt.NetworkDefinitionCreationFlag.STRONGLY_TYPED)) + config = builder.create_builder_config() + config.builder_optimization_level = 3 + # TF32 would round every float32 matrix product and convolution input to a + # 10-bit mantissa; the family is a float32 build of a float32 checkpoint. + config.clear_flag(trt.BuilderFlag.TF32) + return builder, network, config + + +def _tuned_visible(cfg: dict) -> int: + per_tubelet = cfg["grid"] * cfg["grid"] + visible = (per_tubelet - int(_TUNED_MASK_RATIO * per_tubelet)) * ( + cfg["num_frames"] // cfg["tubelet_size"]) + return min(max(visible, 1), cfg["tubes"] - 1) + + +def build_engine(weights: dict, cfg: dict, *, verbose: bool = False) -> bytes: + """Serialize the float32 engine of one VideoMAE pre-training checkpoint.""" + builder, network, config = _builder(verbose) + frames, size = cfg["num_frames"], cfg["image_size"] + encoder, decoder = cfg["encoder"], cfg["decoder"] + eps = cfg["layer_norm_eps"] + + pixels = network.add_input("pixel_values", trt.float32, (1, frames, 3, size, size)) + visible = network.add_input("visible_index", trt.int32, (-1,)) + masked = network.add_input("masked_index", trt.int32, (-1,)) + + # Tubelet embedding: a Conv3d whose stride equals its kernel, over [1, 3, T, H, W]. + channels_first = network.add_shuffle(pixels) + channels_first.first_transpose = (0, 2, 1, 3, 4) + projection = network.add_convolution_nd( + channels_first.get_output(0), encoder["width"], + (cfg["tubelet_size"], cfg["patch_size"], cfg["patch_size"]), + trt.Weights(np.ascontiguousarray( + weights["videomae.embeddings.patch_embeddings.projection.weight"])), + trt.Weights(np.ascontiguousarray( + weights["videomae.embeddings.patch_embeddings.projection.bias"]))) + projection.stride_nd = (cfg["tubelet_size"], cfg["patch_size"], cfg["patch_size"]) + tokens = network.add_shuffle(projection.get_output(0)) + tokens.reshape_dims = (1, encoder["width"], cfg["tubes"]) + tokens.second_transpose = (0, 2, 1) + rows = g.add(network, tokens.get_output(0), + g.constant(network, g.sinusoid_table(cfg["tubes"], encoder["width"])[None])) + + # The encoder runs on the visible tubes only. + rows = network.add_gather(rows, visible, 1).get_output(0) + for index in range(encoder["layers"]): + rows = g.transformer_layer(network, rows, weights, f"videomae.encoder.layer.{index}.", + encoder["heads"], eps) + if cfg["final_layernorm"]: + rows = g.layer_norm(network, rows, weights["videomae.layernorm.weight"], + weights["videomae.layernorm.bias"], eps) + rows = g.linear(network, rows, weights["encoder_to_decoder.weight"]) + + # Decoder input: the visible tubes, then a mask token per masked tube, each + # with the decoder position of its tube. + positions = g.constant(network, g.sinusoid_table(cfg["tubes"], decoder["width"])[None]) + shown = g.add(network, rows, network.add_gather(positions, visible, 1).get_output(0)) + hidden = g.add(network, g.constant(network, weights["mask_token"]), + network.add_gather(positions, masked, 1).get_output(0)) + sequence = network.add_concatenation([shown, hidden]) + sequence.axis = 1 + rows = sequence.get_output(0) + for index in range(decoder["layers"]): + rows = g.transformer_layer(network, rows, weights, f"decoder.decoder_layers.{index}.", + decoder["heads"], eps) + rows = g.last_rows(network, rows, visible, masked, decoder["width"]) + # nn.LayerNorm's default epsilon: the decoder norm does not take layer_norm_eps. + rows = g.layer_norm(network, rows, weights["decoder.norm.weight"], + weights["decoder.norm.bias"], 1e-5) + logits = g.linear(network, rows, weights["decoder.head.weight"], weights["decoder.head.bias"]) + logits.name = "logits" + network.mark_output(logits) + + tuned = _tuned_visible(cfg) + profile = builder.create_optimization_profile() + profile.set_shape("visible_index", (1,), (tuned,), (cfg["tubes"] - 1,)) + profile.set_shape("masked_index", (1,), (cfg["tubes"] - tuned,), (cfg["tubes"] - 1,)) + config.add_optimization_profile(profile) + plan = builder.build_serialized_network(network, config) + if plan is None: + raise RuntimeError("videomae engine build failed") + return bytes(plan) + + +def build(request, writer) -> None: + """Build one VideoMAE bundle for the masked_video_text_to_video Task.""" + if request.task != _TASK: + raise ValueError(f"videomae supports only task={_TASK}") + if request.backend != "trt": + raise ValueError("videomae supports only backend=trt") + if str(request.precision).lower() != "fp32": + raise NotImplementedError( + f"videomae builds the checkpoint's float32 only; {request.precision} is not qualified") + if request.quantization not in (None, "none"): + raise NotImplementedError(f"videomae does not support quantization {request.quantization!r}") + if request.fp32_layers: + raise NotImplementedError("videomae does not support mixed-precision layers") + for name, value in (("max_batch_size", request.max_batch_size), + ("tensor_parallel_size", request.tensor_parallel_size), + ("context_parallel_size", request.context_parallel_size), + ("image_height", request.image_height), + ("image_width", request.image_width), + ("video_num_frames", request.video_num_frames)): + if value is not None and (isinstance(value, bool) or not isinstance(value, int)): + raise ValueError(f"videomae needs an integer {name}; got {value!r}") + if request.max_batch_size != 1: + raise NotImplementedError("videomae reconstructs one clip per request") + if request.tensor_parallel_size != 1: + raise NotImplementedError("videomae does not support tensor parallelism") + if request.context_parallel_size != 1: + raise NotImplementedError("videomae does not support context parallelism") + if request.dynamic_kv_cache: + raise NotImplementedError("videomae does not support dynamic_kv_cache") + if request.mtp_seq_len is not None: + raise NotImplementedError("videomae does not support MTP speculative decoding") + if request.max_sequence_length is not None: + # The tubes follow from the clip size; every split of them into shown and + # reconstructed tubes runs on the one engine. + raise NotImplementedError("videomae derives its sequence lengths from the clip size") + + model_dir = Path(request.model_dir) + cfg = config_module.resolve(model_dir) + for value, expected, name in ( + (request.image_height, cfg["image_size"], "image_height"), + (request.image_width, cfg["image_size"], "image_width"), + (request.video_num_frames, cfg["num_frames"], "video_num_frames"), + ): + if value is not None and value != expected: + # The position tables have one row per tube of the trained clip. + raise NotImplementedError( + f"videomae {name} is fixed at the checkpoint's {expected}; got {value}") + weights = _open_checkpoint(model_dir, cfg) + + writer.set_header(family="videomae", task=request.task, backend=request.backend) + writer.add_bytes("engine.plan", build_engine(weights, cfg, verbose=bool(request.verbose))) + writer.add_json( + "runtime.json", + { + "num_frames": cfg["num_frames"], + "image_size": cfg["image_size"], + "patch_size": cfg["patch_size"], + "tubelet_size": cfg["tubelet_size"], + "image_mean": cfg["image_mean"], + "image_std": cfg["image_std"], + }, + ) diff --git a/families/videomae/runtime/CMakeLists.txt b/families/videomae/runtime/CMakeLists.txt new file mode 100644 index 0000000000..8f2865d0f4 --- /dev/null +++ b/families/videomae/runtime/CMakeLists.txt @@ -0,0 +1,76 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +add_library(trtmc_model_videomae SHARED + bundle_config.cpp + clip.cpp + pipeline.cpp + plugin.cpp +) + +target_include_directories(trtmc_model_videomae + PRIVATE + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/core/runtime/include +) +target_include_directories(trtmc_model_videomae SYSTEM PRIVATE + ${TRTMC_CUDA_INCLUDE_DIR} +) +target_link_libraries(trtmc_model_videomae PRIVATE + trtmc_core + nlohmann_json::nlohmann_json + ${TRTMC_CUDART_LIBRARY} + ${CMAKE_DL_LIBS} +) +target_compile_options(trtmc_model_videomae PRIVATE + "$<$:-Wall;-Wextra;-Wpedantic>" +) +set_target_properties(trtmc_model_videomae PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" + BUILD_RPATH "\$ORIGIN" + INSTALL_RPATH "\$ORIGIN" +) +install(TARGETS trtmc_model_videomae + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +# The family's NOTICE (the sources it follows, the checkpoint's license) ships with the library. +install(FILES ${PROJECT_SOURCE_DIR}/families/videomae/NOTICE + DESTINATION ${CMAKE_INSTALL_DATADIR}/trtmc/families/videomae +) + +if(TRTMC_BUILD_TESTS) + add_executable(test_videomae_clip + ${PROJECT_SOURCE_DIR}/families/videomae/tests/cpp/test_clip.cpp + ) + target_include_directories(test_videomae_clip PRIVATE + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/core/runtime/include + ) + target_include_directories(test_videomae_clip SYSTEM PRIVATE + ${TRTMC_CUDA_INCLUDE_DIR} + ) + target_link_libraries(test_videomae_clip PRIVATE trtmc_model_videomae nlohmann_json::nlohmann_json) + target_compile_options(test_videomae_clip PRIVATE -Wall -Wextra -Wpedantic -Werror) + add_test(NAME videomae_clip COMMAND test_videomae_clip) + set_tests_properties(videomae_clip PROPERTIES LABELS "cpu") + + foreach(_language IN ITEMS c cpp) + add_executable(test_videomae_sdk_${_language} + ${PROJECT_SOURCE_DIR}/families/videomae/tests/sdk_consumer.${_language} + ) + target_link_libraries(test_videomae_sdk_${_language} PRIVATE trtmc_c) + target_compile_options(test_videomae_sdk_${_language} PRIVATE + -Wall -Wextra -Wpedantic -Werror + ) + set_target_properties(test_videomae_sdk_${_language} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" + ) + # A clip whose byte count overflows is refused before any allocation or load. + add_test(NAME videomae_sdk_${_language}_refuses_an_oversized_clip + COMMAND test_videomae_sdk_${_language} bundle runtime frames u8 16 1073741824 1073741824 mask out + ) + set_tests_properties(videomae_sdk_${_language}_refuses_an_oversized_clip PROPERTIES + LABELS "cpu" PASS_REGULAR_EXPRESSION "clip size overflows host storage" + ) + endforeach() +endif() diff --git a/families/videomae/runtime/bundle_config.cpp b/families/videomae/runtime/bundle_config.cpp new file mode 100644 index 0000000000..568a0e5c3d --- /dev/null +++ b/families/videomae/runtime/bundle_config.cpp @@ -0,0 +1,141 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "families/videomae/runtime/bundle_config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace trtmc::videomae { +namespace { + +using Json = nlohmann::json; + +[[noreturn]] void refuse(const std::string& what) { + throw std::runtime_error("videomae runtime.json " + what); +} + +// nlohmann keeps the last of repeated keys; refuse them instead. +Json parse_without_repeated_keys(std::string_view text) { + std::vector> keys; + return Json::parse(text.begin(), text.end(), + [&keys](int, Json::parse_event_t event, Json& parsed) { + if (event == Json::parse_event_t::object_start) { + keys.emplace_back(); + } else if (event == Json::parse_event_t::object_end) { + keys.pop_back(); + } else if (event == Json::parse_event_t::key && + !keys.back().insert(parsed.get()).second) { + refuse("repeats the key " + parsed.get()); + } + return true; + }); +} + +std::int64_t integer(const Json& object, const char* key) { + const auto& value = object.at(key); + if (!value.is_number_integer() || + (value.is_number_unsigned() && + value.get() > + static_cast(std::numeric_limits::max()))) + refuse(std::string("needs an integer ") + key); + return value.get(); +} + +std::array channels(const Json& object, const char* key) { + const auto& value = object.at(key); + if (!value.is_array() || value.size() != 3) + refuse(std::string("needs three values for ") + key); + std::array result{}; + for (std::size_t channel = 0; channel < 3; ++channel) { + const auto& item = value[channel]; + if (!item.is_number()) + refuse(std::string("needs numbers for ") + key); + const double number = item.get(); + if (!std::isfinite(number) || std::fabs(number) > std::numeric_limits::max()) + refuse(std::string("needs finite float32 values for ") + key); + result[channel] = static_cast(number); + } + return result; +} + +} // namespace + +RuntimeConfig parse_runtime_config(std::string_view text) { + Json json; + try { + json = parse_without_repeated_keys(text); + } catch (const Json::exception& error) { + refuse(std::string("is not valid JSON: ") + error.what()); + } + static const std::set kKeys{"num_frames", "image_size", "patch_size", + "tubelet_size", "image_mean", "image_std"}; + if (!json.is_object()) + refuse("must be an object"); + std::set present; + for (const auto& item : json.items()) + present.insert(item.key()); + if (present != kKeys) + refuse("must hold exactly num_frames, image_size, patch_size, tubelet_size, image_mean " + "and image_std"); + RuntimeConfig config; + config.geometry = {integer(json, "num_frames"), integer(json, "image_size"), + integer(json, "patch_size"), integer(json, "tubelet_size")}; + validate_geometry(config.geometry); + config.normalization = {channels(json, "image_mean"), channels(json, "image_std")}; + for (std::size_t channel = 0; channel < 3; ++channel) { + const float mean = config.normalization.mean[channel]; + const float std = config.normalization.std[channel]; + if (!(std > 0.0F)) + refuse("needs positive image_std values"); + // The runtime normalizes in float32: (pixel - mean) / std for pixels in [0, 1]. + for (const float pixel : {0.0F, 1.0F}) + if (!std::isfinite((pixel - mean) / std)) + refuse("has channel statistics that overflow float32 for pixels in [0, 1]"); + } + return config; +} + +void validate_engine(const ITrtModule& engine, const ClipGeometry& geometry) { + const auto check = [](bool condition, const char* what) { + if (!condition) + throw std::runtime_error(std::string("videomae engine ") + what); + }; + const auto inputs = engine.input_info(); + const auto outputs = engine.output_info(); + check(inputs.size() == 3 && outputs.size() == 1 && engine.has_input("pixel_values") && + engine.has_input("visible_index") && engine.has_input("masked_index") && + engine.has_output("logits"), + "must have the inputs pixel_values, visible_index, masked_index and the output logits"); + check(engine.tensor_dtype("pixel_values") == DType::kFloat32 && + engine.tensor_shape("pixel_values") == + std::vector{1, geometry.frames, ClipGeometry::kChannels, + geometry.size, geometry.size}, + "pixel_values does not match runtime.json"); + // Every split of the tubes into conditioning and reconstructed ones, 1 to tubes - 1 + // of each, must fit the engine's dynamic index inputs. + const std::vector fewest{1}, most{geometry.tubes() - 1}; + for (const char* name : {"visible_index", "masked_index"}) + check(engine.tensor_dtype(name) == DType::kInt32 && engine.input_rank(name) == 1 && + engine.input_is_dynamic(name) && engine.optimization_profile_count() >= 1 && + engine.input_profile_shape(name, 0, ProfileShapeSelector::kMin) == fewest && + engine.input_profile_shape(name, 0, ProfileShapeSelector::kMax) == most, + "tube index inputs must be dynamic int32 vectors of 1 to tubes - 1 entries"); + // The module sizes outputs for the largest profile, so logits must report tubes - 1 + // reconstructed tubes here: a fixed masked length would only fail at inference. + const auto logits = engine.tensor_shape("logits"); + check(engine.tensor_dtype("logits") == DType::kFloat32 && logits.size() == 3 && + logits[0] == 1 && logits[1] == geometry.tubes() - 1 && + logits[2] == geometry.tube_values(), + "logits must be float32 [1, masked tubes, tube values] for runtime.json"); +} + +} // namespace trtmc::videomae diff --git a/families/videomae/runtime/bundle_config.h b/families/videomae/runtime/bundle_config.h new file mode 100644 index 0000000000..242b62433b --- /dev/null +++ b/families/videomae/runtime/bundle_config.h @@ -0,0 +1,30 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "families/videomae/runtime/clip.h" +#include "trtmc/runtime/trt_module.h" + +#include + +namespace trtmc::videomae { + +struct RuntimeConfig { + ClipGeometry geometry; + PixelNormalization normalization; +}; + +// Parses the bundle's runtime.json: one object with exactly the keys the +// builder writes, integers as JSON integers, three finite statistics per +// channel, no repeated key. Throws std::runtime_error otherwise. +RuntimeConfig parse_runtime_config(std::string_view text); + +// Checks the engine's tensors against the clip geometry before first use: +// pixel_values float32 [1, frames, 3, size, size]; visible_index and +// masked_index int32 of rank 1; logits float32 [1, M, tube values]. +void validate_engine(const ITrtModule& engine, const ClipGeometry& geometry); + +} // namespace trtmc::videomae diff --git a/families/videomae/runtime/clip.cpp b/families/videomae/runtime/clip.cpp new file mode 100644 index 0000000000..1a6156cf2d --- /dev/null +++ b/families/videomae/runtime/clip.cpp @@ -0,0 +1,203 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "families/videomae/runtime/clip.h" + +#include +#include +#include +#include +#include +#include + +namespace trtmc::videomae { +namespace { + +// The checkpoint's pixel targets are (value - mean) / (std + 1e-6) per tube +// and channel (norm_pix_loss); reconstruction applies the inverse. +constexpr double kStdEpsilon = 1e-6; + +std::size_t index(std::int64_t value) { + return static_cast(value); +} + +// Offset of pixel (frame, row, column) in an FHW plane stack. +std::int64_t plane_offset(const ClipGeometry& geometry, std::int64_t frame, std::int64_t row, + std::int64_t column) { + return (frame * geometry.size + row) * geometry.size + column; +} + +struct TubeOrigin { + std::int64_t frame, row, column; +}; + +TubeOrigin origin(const ClipGeometry& geometry, std::int64_t tube) { + const auto grid = geometry.grid(); + return {tube / (grid * grid) * geometry.tubelet, tube / grid % grid * geometry.patch, + tube % grid * geometry.patch}; +} + +std::string describe(const TubeOrigin& tube) { + return "frame " + std::to_string(tube.frame) + ", row " + std::to_string(tube.row) + + ", column " + std::to_string(tube.column); +} + +// Calls `visit(pixel, offset)` for the tube's pixels in (frame, row, column) +// order; `offset` is the pixel's index in an FHW plane stack. +template +void for_each_pixel(const ClipGeometry& geometry, const TubeOrigin& tube, Visit&& visit) { + std::int64_t pixel = 0; + for (std::int64_t frame = 0; frame < geometry.tubelet; ++frame) + for (std::int64_t row = 0; row < geometry.patch; ++row) + for (std::int64_t column = 0; column < geometry.patch; ++column) + visit(pixel++, plane_offset(geometry, tube.frame + frame, tube.row + row, + tube.column + column)); +} + +void copy_frame(const internal::ImageView& frame, float* out, std::size_t count) { + if (frame.format == internal::ImageFormat::UInt8) { + const auto* values = static_cast(frame.data); + for (std::size_t i = 0; i < count; ++i) + out[i] = static_cast(static_cast(values[i]) * (1.0 / 255.0)); + return; + } + const auto* values = static_cast(frame.data); + for (std::size_t i = 0; i < count; ++i) { + if (!(values[i] >= 0.0F && values[i] <= 1.0F)) + throw std::invalid_argument( + "videomae float32 frames must hold finite values in [0, 1]"); + out[i] = values[i]; + } +} + +} // namespace + +void validate_geometry(const ClipGeometry& geometry) { + const auto limit = static_cast(std::numeric_limits::max()); + if (geometry.frames <= 0 || geometry.size <= 0 || geometry.patch <= 0 || + geometry.tubelet <= 0 || geometry.frames > limit || geometry.size > limit || + geometry.size % geometry.patch != 0 || geometry.frames % geometry.tubelet != 0) + throw std::runtime_error("videomae runtime.json does not describe whole tubes"); + // Bounds by division first, so that no product below can overflow. + if (geometry.size > limit / ClipGeometry::kChannels / geometry.size || + geometry.frame_values() > limit / geometry.frames) + throw std::runtime_error("videomae runtime.json describes an oversized clip"); + if (geometry.tubes() < 2 || geometry.tube_pixels() < 2) + throw std::runtime_error("videomae needs at least two tubes of at least two pixels"); +} + +std::vector source_clip(Span frames, + const ClipGeometry& geometry) { + if (frames.size() != index(geometry.frames)) + throw std::invalid_argument("videomae reconstructs clips of exactly " + + std::to_string(geometry.frames) + " frames; got " + + std::to_string(frames.size())); + const auto count = index(geometry.frame_values()); + std::vector clip(index(geometry.frames) * count); + for (std::size_t f = 0; f < frames.size(); ++f) { + const auto& frame = frames[f]; + if (frame.height != geometry.size || frame.width != geometry.size || + frame.channels != ClipGeometry::kChannels) + throw std::invalid_argument( + "videomae frames must be " + std::to_string(geometry.size) + "x" + + std::to_string(geometry.size) + + " RGB (resize and center-crop them as the checkpoint's processor does); frame " + + std::to_string(f) + " is " + std::to_string(frame.height) + "x" + + std::to_string(frame.width) + " with " + std::to_string(frame.channels) + + " channels"); + copy_frame(frame, clip.data() + f * count, count); + } + return clip; +} + +std::vector pixel_values(const std::vector& clip, const ClipGeometry& geometry, + const PixelNormalization& normalization) { + const auto plane = index(geometry.size * geometry.size); + if (clip.size() != index(geometry.frames) * plane * ClipGeometry::kChannels) + throw std::logic_error("videomae clip does not match its geometry"); + std::vector values(clip.size()); + for (std::size_t frame = 0; frame < index(geometry.frames); ++frame) + for (std::size_t pixel = 0; pixel < plane; ++pixel) + for (std::size_t channel = 0; channel < ClipGeometry::kChannels; ++channel) + values[(frame * ClipGeometry::kChannels + channel) * plane + pixel] = + (clip[(frame * plane + pixel) * ClipGeometry::kChannels + channel] - + normalization.mean[channel]) / + normalization.std[channel]; + return values; +} + +TubeSelection select_tubes(const internal::VideoMaskView& mask, const ClipGeometry& geometry) { + if (mask.frames != index(geometry.frames) || mask.height != index(geometry.size) || + mask.width != index(geometry.size) || + mask.values.size() != index(geometry.frames * geometry.size * geometry.size)) + throw std::invalid_argument("videomae mask must cover every pixel of the clip"); + TubeSelection selection; + for (std::int64_t tube = 0; tube < geometry.tubes(); ++tube) { + const auto start = origin(geometry, tube); + const float kind = + mask.values[index(plane_offset(geometry, start.frame, start.row, start.column))]; + if (kind != 0.0F && kind != 1.0F) + throw std::invalid_argument("videomae mask values must be 0 (condition) or 1 " + "(reconstruct); the tube at " + + describe(start) + " starts with another value"); + for_each_pixel(geometry, start, [&](std::int64_t, std::int64_t offset) { + if (mask.values[index(offset)] != kind) + throw std::invalid_argument( + "videomae masks select whole tubes of " + std::to_string(geometry.tubelet) + + " frames x " + std::to_string(geometry.patch) + "x" + + std::to_string(geometry.patch) + " pixels, each all 0 or all 1; the tube at " + + describe(start) + " is mixed"); + }); + (kind == 1.0F ? selection.masked : selection.visible) + .push_back(static_cast(tube)); + } + if (selection.masked.empty()) + throw std::invalid_argument("the videomae mask selects no tube to reconstruct"); + if (selection.visible.empty()) + throw std::invalid_argument( + "the videomae mask selects every tube; at least one tube must condition the " + "reconstruction"); + return selection; +} + +void reconstruct(std::vector& clip, const float* predictions, const TubeSelection& selection, + const ClipGeometry& geometry) { + constexpr auto channels = static_cast(ClipGeometry::kChannels); + if (clip.size() != index(geometry.frames * geometry.frame_values())) + throw std::logic_error("videomae clip does not match its geometry"); + const double samples = static_cast(geometry.tube_pixels()); + for (std::size_t row = 0; row < selection.masked.size(); ++row) { + const auto start = origin(geometry, selection.masked[row]); + std::array mean{}, spread{}; + for_each_pixel(geometry, start, [&](std::int64_t, std::int64_t offset) { + for (std::size_t c = 0; c < channels; ++c) + mean[c] += clip[index(offset) * channels + c]; + }); + for (auto& value : mean) + value /= samples; + for_each_pixel(geometry, start, [&](std::int64_t, std::int64_t offset) { + for (std::size_t c = 0; c < channels; ++c) { + const double deviation = clip[index(offset) * channels + c] - mean[c]; + spread[c] += deviation * deviation; + } + }); + for (auto& value : spread) + value = std::sqrt(value / (samples - 1.0)) + kStdEpsilon; + const float* prediction = predictions + row * index(geometry.tube_values()); + for_each_pixel(geometry, start, [&](std::int64_t pixel, std::int64_t offset) { + for (std::size_t c = 0; c < channels; ++c) { + const double value = + static_cast(prediction[index(pixel) * channels + c]) * spread[c] + + mean[c]; + if (!std::isfinite(value)) + throw std::runtime_error("videomae engine returned a non-finite prediction"); + clip[index(offset) * channels + c] = + static_cast(std::clamp(value, 0.0, 1.0)); + } + }); + } +} + +} // namespace trtmc::videomae diff --git a/families/videomae/runtime/clip.h b/families/videomae/runtime/clip.h new file mode 100644 index 0000000000..1c0f7985c8 --- /dev/null +++ b/families/videomae/runtime/clip.h @@ -0,0 +1,70 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "trtmc/internal/video.h" + +#include +#include +#include + +namespace trtmc::videomae { + +// One bundle's clip: `frames` RGB frames of `size` x `size` pixels, cut into +// tubes of `tubelet` frames x `patch` x `patch` pixels. Tube numbers run over +// (tubelet, row, column): tube = (t * grid + row) * grid + column. +struct ClipGeometry { + static constexpr std::int64_t kChannels = 3; + std::int64_t frames{0}; + std::int64_t size{0}; + std::int64_t patch{0}; + std::int64_t tubelet{0}; + + std::int64_t grid() const noexcept { return size / patch; } + std::int64_t tubes() const noexcept { return frames / tubelet * grid() * grid(); } + std::int64_t tube_pixels() const noexcept { return tubelet * patch * patch; } + std::int64_t tube_values() const noexcept { return tube_pixels() * kChannels; } + std::int64_t frame_values() const noexcept { return size * size * kChannels; } +}; + +// Throws std::runtime_error unless the geometry describes whole tubes of a +// clip small enough for every index the runtime computes. +void validate_geometry(const ClipGeometry& geometry); + +struct PixelNormalization { + std::array mean{}; + std::array std{}; +}; + +// The request frames as one THWC float32 clip in [0, 1]. 8-bit values are +// scaled as the checkpoint's processor rescales them: the double product with +// 1/255, rounded to float32. Float32 frames must already lie in [0, 1]. +std::vector source_clip(Span frames, + const ClipGeometry& geometry); + +// The engine input `pixel_values`: [1, frames, 3, size, size], normalized per +// channel in float32 as (value - mean) / std. +std::vector pixel_values(const std::vector& clip, const ClipGeometry& geometry, + const PixelNormalization& normalization); + +struct TubeSelection { + std::vector visible; // Conditioning tubes, ascending. + std::vector masked; // Tubes to reconstruct, ascending. +}; + +// Reads a mask that selects whole tubes: every value is 0 (condition) or 1 +// (reconstruct) and constant on each tube; at least one tube of each kind. +TubeSelection select_tubes(const internal::VideoMaskView& mask, const ClipGeometry& geometry); + +// Replaces every masked tube of `clip` by its prediction. Row i of +// `predictions` holds tube selection.masked[i], normalized by that tube's own +// per-channel mean and unbiased standard deviation, values in (frame, row, +// column, channel) order. The statistics are taken from the source pixels of +// the tube; the result is clamped to [0, 1]. +void reconstruct(std::vector& clip, const float* predictions, const TubeSelection& selection, + const ClipGeometry& geometry); + +} // namespace trtmc::videomae diff --git a/families/videomae/runtime/pipeline.cpp b/families/videomae/runtime/pipeline.cpp new file mode 100644 index 0000000000..18a987e75f --- /dev/null +++ b/families/videomae/runtime/pipeline.cpp @@ -0,0 +1,92 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "families/videomae/runtime/pipeline.h" + +#include "families/videomae/runtime/bundle_config.h" + +#include +#include +#include + +namespace trtmc::videomae { +namespace { + +using Clock = std::chrono::steady_clock; + +double milliseconds(Clock::time_point start, Clock::time_point end) { + return std::chrono::duration(end - start).count(); +} + +const Tensor& require_predictions(const TensorMap& outputs, std::size_t tubes, + const ClipGeometry& geometry) { + const auto found = outputs.find("logits"); + if (found == outputs.end()) + throw std::runtime_error("videomae engine did not return logits"); + const auto& logits = found->second; + const std::vector expected{1, static_cast(tubes), + geometry.tube_values()}; + if (logits.data == nullptr || logits.dtype != DType::kFloat32 || logits.shape != expected) + throw std::runtime_error("videomae engine returned logits of an unexpected shape or type"); + return logits; +} + +} // namespace + +MaskedVideoReconstruction::MaskedVideoReconstruction(std::unique_ptr engine, + ClipGeometry geometry, + PixelNormalization normalization) + : engine_(std::move(engine)), geometry_(geometry), normalization_(normalization) { + if (!engine_ || !engine_->ok()) + throw std::runtime_error("videomae engine is not loaded"); + validate_geometry(geometry_); + validate_engine(*engine_, geometry_); +} + +internal::VideoResult +MaskedVideoReconstruction::run(const internal::MaskedVideoTextToVideoRequest& request, + internal::ConfigView config) { + if (!config.empty()) + throw internal::ConfigError("videomae has no runtime configuration"); + if (!request.prompt.empty()) + throw std::invalid_argument("videomae has no text condition; the prompt must be empty"); + const auto start = Clock::now(); + auto clip = source_clip(request.source.frames, geometry_); + auto selection = select_tubes(request.mask, geometry_); + auto values = pixel_values(clip, geometry_, normalization_); + + Tensor pixels; + pixels.data = values.data(); + pixels.shape = {1, geometry_.frames, ClipGeometry::kChannels, geometry_.size, geometry_.size}; + pixels.dtype = DType::kFloat32; + Tensor visible; + visible.data = selection.visible.data(); + visible.shape = {static_cast(selection.visible.size())}; + visible.dtype = DType::kInt32; + Tensor masked; + masked.data = selection.masked.data(); + masked.shape = {static_cast(selection.masked.size())}; + masked.dtype = DType::kInt32; + const auto prepared = Clock::now(); + const auto outputs = engine_->forward( + {{"pixel_values", pixels}, {"visible_index", visible}, {"masked_index", masked}}); + const auto& predictions = require_predictions(outputs, selection.masked.size(), geometry_); + reconstruct(clip, static_cast(predictions.data), selection, geometry_); + + internal::VideoResult result; + result.frames.pixels = std::move(clip); + result.frames.height = static_cast(geometry_.size); + result.frames.width = static_cast(geometry_.size); + result.frames.channels = static_cast(ClipGeometry::kChannels); + result.frames.num_frames = static_cast(geometry_.frames); + // Frame i of the result is the reconstruction of source frame i. + result.timestamps_seconds.assign(request.source.timestamps_seconds.begin(), + request.source.timestamps_seconds.end()); + result.setup_ms = milliseconds(start, prepared); + result.inference_ms = milliseconds(prepared, Clock::now()); + return result; +} + +} // namespace trtmc::videomae diff --git a/families/videomae/runtime/pipeline.h b/families/videomae/runtime/pipeline.h new file mode 100644 index 0000000000..0a29a94c3f --- /dev/null +++ b/families/videomae/runtime/pipeline.h @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "families/videomae/runtime/clip.h" +#include "trtmc/internal/model.h" +#include "trtmc/internal/video.h" +#include "trtmc/runtime/trt_module.h" + +#include +#include + +namespace trtmc::videomae { + +// Reconstructs the masked tubes of one clip with VideoMAEForPreTraining. The +// result keeps every conditioning tube's source pixels and replaces each +// masked tube with the model's prediction. +class MaskedVideoReconstruction final : public internal::IModel, + public internal::IMaskedVideoTextToVideo { + public: + MaskedVideoReconstruction(std::unique_ptr engine, ClipGeometry geometry, + PixelNormalization normalization); + + const char* task() const noexcept override { return IMaskedVideoTextToVideo::kTask.data(); } + std::vector task_bindings() override { + return {internal::bind(*this)}; + } + internal::VideoResult run(const internal::MaskedVideoTextToVideoRequest& request, + internal::ConfigView config) override; + + private: + std::unique_ptr engine_; + ClipGeometry geometry_; + PixelNormalization normalization_; +}; + +} // namespace trtmc::videomae diff --git a/families/videomae/runtime/plugin.cpp b/families/videomae/runtime/plugin.cpp new file mode 100644 index 0000000000..1ae6b5bf56 --- /dev/null +++ b/families/videomae/runtime/plugin.cpp @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "families/videomae/runtime/bundle_config.h" +#include "families/videomae/runtime/pipeline.h" +#include "trtmc/runtime/family_factory.h" +#include "trtmc/runtime/trt_backend.h" + +#include +#include +#include +#include + +namespace trtmc::videomae { +namespace { + +std::vector require_section(const BundleReader& bundle, const char* name) { + const auto* section = bundle.find_section(name); + if (section == nullptr || section->length == 0) + throw std::runtime_error("bundle section is missing or empty: " + std::string(name)); + return bundle.read_section(name); +} + +} // namespace +} // namespace trtmc::videomae + +extern "C" trtmc::ITask* trtmc_create_family(const trtmc::FamilyContext& context) { + using namespace trtmc::videomae; + if (context.kv_cache_size_bytes != 0) + throw std::invalid_argument("videomae does not support --kv-cache-size"); + const auto text = require_section(context.reader, "runtime.json"); + const auto config = parse_runtime_config(std::string_view(text.data(), text.size())); + const auto plan = require_section(context.reader, "engine.plan"); + auto engine = context.backend.create_module(plan.data(), plan.size(), {}); + if (!engine || !engine->ok()) + throw std::runtime_error("videomae engine failed to load"); + return new MaskedVideoReconstruction(std::move(engine), config.geometry, config.normalization); +} diff --git a/families/videomae/support.py b/families/videomae/support.py new file mode 100644 index 0000000000..5fe32e0993 --- /dev/null +++ b/families/videomae/support.py @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Family-owned model and task support for VideoMAE pre-training checkpoints.""" + +from tensorrt_model_connect.model_support import family_support + + +# Only the pre-training head carries the pixel decoder this family runs. Video +# classification fine-tunes share model_type "videomae" and stay unclaimed. +describe = family_support( + architectures=("VideoMAEForPreTraining",), + tasks=("masked_video_text_to_video",), + default_task="masked_video_text_to_video", +) diff --git a/families/videomae/tests/__init__.py b/families/videomae/tests/__init__.py new file mode 100644 index 0000000000..8c776d6f23 --- /dev/null +++ b/families/videomae/tests/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Tests of the videomae family.""" diff --git a/families/videomae/tests/cpp/test_clip.cpp b/families/videomae/tests/cpp/test_clip.cpp new file mode 100644 index 0000000000..aa3dff3063 --- /dev/null +++ b/families/videomae/tests/cpp/test_clip.cpp @@ -0,0 +1,438 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +// Host-side clip handling of the videomae runtime: tube layout, request +// checks, normalization and reconstruction, without an engine or a GPU. + +#include "families/videomae/runtime/bundle_config.h" +#include "families/videomae/runtime/clip.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +using trtmc::videomae::ClipGeometry; +using trtmc::videomae::PixelNormalization; +using trtmc::videomae::TubeSelection; + +int failures = 0; + +void expect(bool condition, const std::string& what) { + if (!condition) { + std::cerr << "FAILED: " << what << '\n'; + ++failures; + } +} + +template +void expect_throws(const std::function& call, const std::string& what, + const std::string& fragment = "") { + try { + call(); + } catch (const Error& error) { + expect(fragment.empty() || std::string(error.what()).find(fragment) != std::string::npos, + what + " (message: " + error.what() + ")"); + return; + } catch (const std::exception& error) { + expect(false, what + " threw the wrong type: " + error.what()); + return; + } + expect(false, what + " did not throw"); +} + +// 4 frames of 4x4 pixels in tubes of 2 frames x 2x2 pixels: 2 tubelets x 2 x 2 +// = 8 tubes of 8 pixels (24 values). +const ClipGeometry kGeometry{4, 4, 2, 2}; + +std::size_t plane(std::int64_t frame, std::int64_t row, std::int64_t column) { + return static_cast((frame * kGeometry.size + row) * kGeometry.size + column); +} + +// A mask whose tubes in `masked` are 1, every other value 0. +std::vector tube_mask(const std::vector& masked) { + std::vector values(static_cast(4 * 4 * 4), 0.0F); + for (const auto tube : masked) { + const auto t = tube / 4, row = tube / 2 % 2, column = tube % 2; + for (std::int64_t f = 0; f < 2; ++f) + for (std::int64_t y = 0; y < 2; ++y) + for (std::int64_t x = 0; x < 2; ++x) + values[plane(t * 2 + f, row * 2 + y, column * 2 + x)] = 1.0F; + } + return values; +} + +TubeSelection select(const std::vector& values) { + return trtmc::videomae::select_tubes({{values.data(), values.size()}, 4, 4, 4}, kGeometry); +} + +std::vector frames_of(const std::vector& clip, + std::size_t count, std::uint32_t size, + std::uint32_t channels) { + std::vector frames; + const std::size_t bytes = std::size_t{size} * size * channels; + for (std::size_t f = 0; f < count; ++f) + frames.push_back({clip.data() + f * bytes, bytes, size, size, channels, + trtmc::internal::ImageFormat::UInt8}); + return frames; +} + +void geometry_layout() { + expect(kGeometry.grid() == 2 && kGeometry.tubes() == 8, "tube count"); + expect(kGeometry.tube_pixels() == 8 && kGeometry.tube_values() == 24, "tube size"); + trtmc::videomae::validate_geometry(kGeometry); + // The checkpoint's clip: 16 frames of 224x224 in 2x16x16 tubes. + const ClipGeometry base{16, 224, 16, 2}; + trtmc::videomae::validate_geometry(base); + expect(base.tubes() == 1568 && base.tube_values() == 1536, "VideoMAE-Base tube layout"); + expect_throws([] { trtmc::videomae::validate_geometry({4, 5, 2, 2}); }, + "a frame size that is not whole patches"); + expect_throws([] { trtmc::videomae::validate_geometry({3, 4, 2, 2}); }, + "a frame count that is not whole tubelets"); + expect_throws([] { trtmc::videomae::validate_geometry({2, 2, 2, 2}); }, + "a single tube"); + // Malformed bundle metadata: refused before any product could overflow. + expect_throws( + [] { trtmc::videomae::validate_geometry({2, 2147483646, 2, 1}); }, + "a frame size whose pixel count overflows", "oversized clip"); + expect_throws( + [] { trtmc::videomae::validate_geometry({65536, 26754, 2, 2}); }, + "a clip too large in total", "oversized clip"); +} + +void tube_selection() { + const auto selection = select(tube_mask({1, 6})); + expect((selection.masked == std::vector{1, 6}), "masked tubes, ascending"); + expect((selection.visible == std::vector{0, 2, 3, 4, 5, 7}), + "visible tubes, ascending"); + + auto mixed = tube_mask({1}); + mixed[plane(1, 0, 3)] = 0.0F; // second frame of tube 1 (rows 0-1, columns 2-3) + expect_throws([&] { select(mixed); }, "a tube that is half masked", + "is mixed"); + auto soft = tube_mask({2}); + for (auto& value : soft) + if (value == 1.0F) + value = 0.5F; + expect_throws([&] { select(soft); }, "a soft mask value", + "must be 0 (condition) or 1"); + auto nan = tube_mask({3}); + nan[plane(0, 2, 2)] = std::numeric_limits::quiet_NaN(); + expect_throws([&] { select(nan); }, "a NaN mask value"); + expect_throws([] { select(tube_mask({})); }, "a mask with no tube", + "no tube to reconstruct"); + expect_throws([] { select(tube_mask({0, 1, 2, 3, 4, 5, 6, 7})); }, + "a mask with every tube", "at least one tube"); + const std::vector short_mask(10, 0.0F); + expect_throws( + [&] { + trtmc::videomae::select_tubes({{short_mask.data(), short_mask.size()}, 4, 4, 4}, + kGeometry); + }, + "a mask that does not cover the clip"); +} + +void source_frames() { + std::vector clip(4 * 4 * 4 * 3); + for (std::size_t i = 0; i < clip.size(); ++i) + clip[i] = static_cast(i * 7 % 256); + const auto frames = frames_of(clip, 4, 4, 3); + const auto values = trtmc::videomae::source_clip({frames.data(), frames.size()}, kGeometry); + bool exact = values.size() == clip.size(); + for (std::size_t i = 0; exact && i < clip.size(); ++i) + exact = values[i] == static_cast(static_cast(clip[i]) * (1.0 / 255.0)); + expect(exact, "8-bit frames are rescaled by 1/255 in double, then rounded to float32"); + + expect_throws( + [&] { trtmc::videomae::source_clip({frames.data(), 3}, kGeometry); }, "three frames", + "exactly 4 frames"); + const auto small = frames_of(clip, 4, 2, 3); + expect_throws( + [&] { trtmc::videomae::source_clip({small.data(), small.size()}, kGeometry); }, + "frames of another size", "4x4 RGB"); + const auto gray = frames_of(clip, 4, 4, 1); + expect_throws( + [&] { trtmc::videomae::source_clip({gray.data(), gray.size()}, kGeometry); }, + "grayscale frames", "with 1 channels"); + + std::vector floats(4 * 4 * 3, 0.25F); + floats[5] = 1.5F; + std::vector float_frames( + 4, {floats.data(), floats.size() * sizeof(float), 4, 4, 3, + trtmc::internal::ImageFormat::Float32}); + expect_throws( + [&] { + trtmc::videomae::source_clip({float_frames.data(), float_frames.size()}, kGeometry); + }, + "a float32 value above 1", "[0, 1]"); +} + +void normalization_layout() { + std::vector clip(4 * 4 * 4 * 3); + for (std::size_t i = 0; i < clip.size(); ++i) + clip[i] = static_cast(i % 17) / 16.0F; + const PixelNormalization normalization{{0.5F, 0.25F, 0.125F}, {0.5F, 2.0F, 0.25F}}; + const auto values = trtmc::videomae::pixel_values(clip, kGeometry, normalization); + bool layout = values.size() == clip.size(); + for (std::size_t frame = 0; layout && frame < 4; ++frame) + for (std::size_t pixel = 0; layout && pixel < 16; ++pixel) + for (std::size_t c = 0; layout && c < 3; ++c) + layout = values[(frame * 3 + c) * 16 + pixel] == + (clip[(frame * 16 + pixel) * 3 + c] - normalization.mean[c]) / + normalization.std[c]; + expect(layout, "pixel_values is [1, frames, 3, size, size], normalized per channel"); +} + +void reconstruction() { + // Tube 5 = tubelet 1, row 0, column 1: frames 2-3, rows 0-1, columns 2-3. + std::vector clip(4 * 4 * 4 * 3, 0.0F); + std::vector source(8 * 3); + std::size_t pixel = 0; + for (std::int64_t f = 2; f < 4; ++f) + for (std::int64_t y = 0; y < 2; ++y) + for (std::int64_t x = 2; x < 4; ++x, ++pixel) + for (std::size_t c = 0; c < 3; ++c) { + const float value = + 0.1F * static_cast(c + 1) + 0.05F * static_cast(pixel % 3); + clip[plane(f, y, x) * 3 + c] = value; + source[pixel * 3 + c] = value; + } + for (std::size_t i = 0; i < clip.size(); ++i) + if (clip[i] == 0.0F) + clip[i] = 0.75F; // every other tube: a visible value that must survive + const TubeSelection selection{{0, 1, 2, 3, 4, 6, 7}, {5}}; + std::vector prediction(24); + for (std::size_t i = 0; i < prediction.size(); ++i) + prediction[i] = static_cast(static_cast(i % 5) - 2) * 0.5F; + prediction[0] = 100.0F; // clamped to 1 + prediction[1] = -100.0F; // clamped to 0 + + std::vector expected(24); + for (std::size_t c = 0; c < 3; ++c) { + double mean = 0.0, spread = 0.0; + for (std::size_t p = 0; p < 8; ++p) + mean += source[p * 3 + c]; + mean /= 8.0; + for (std::size_t p = 0; p < 8; ++p) + spread += (source[p * 3 + c] - mean) * (source[p * 3 + c] - mean); + const double scale = std::sqrt(spread / 7.0) + 1e-6; + for (std::size_t p = 0; p < 8; ++p) + expected[p * 3 + c] = + std::fmin(1.0, std::fmax(0.0, prediction[p * 3 + c] * scale + mean)); + } + auto result = clip; + trtmc::videomae::reconstruct(result, prediction.data(), selection, kGeometry); + // A tolerance, not equality: a compiler may contract the product and sum into one FMA. + bool matches = true; + pixel = 0; + for (std::int64_t f = 2; f < 4; ++f) + for (std::int64_t y = 0; y < 2; ++y) + for (std::int64_t x = 2; x < 4; ++x, ++pixel) + for (std::size_t c = 0; c < 3; ++c) + matches = matches && std::fabs(result[plane(f, y, x) * 3 + c] - + expected[pixel * 3 + c]) < 1e-6; + expect(matches, "a masked tube is its prediction times the unbiased std (+1e-6) plus the mean"); + expect(result[plane(2, 0, 2) * 3] == 1.0F && result[plane(2, 0, 2) * 3 + 1] == 0.0F, + "reconstructed values are clamped to [0, 1]"); + std::size_t kept = 0, visible = 0; + for (std::size_t i = 0; i < clip.size(); ++i) + if (clip[i] == 0.75F) { + ++visible; + kept += result[i] == 0.75F; + } + expect(visible == 7 * 24 && kept == visible, "conditioning tubes keep their source pixels"); + + prediction[3] = std::numeric_limits::infinity(); + expect_throws( + [&] { + auto copy = clip; + trtmc::videomae::reconstruct(copy, prediction.data(), selection, kGeometry); + }, + "a non-finite prediction", "non-finite"); +} + +// runtime.json as the builder writes it for the checkpoint. +const std::string kRuntimeJson = + R"({"num_frames": 16, "image_size": 224, "patch_size": 16, "tubelet_size": 2, )" + R"("image_mean": [0.485, 0.456, 0.406], "image_std": [0.229, 0.224, 0.225]})"; + +std::string replaced(std::string text, const std::string& from, const std::string& to) { + text.replace(text.find(from), from.size(), to); + return text; +} + +void runtime_config() { + const auto config = trtmc::videomae::parse_runtime_config(kRuntimeJson); + expect(config.geometry.frames == 16 && config.geometry.size == 224 && + config.geometry.patch == 16 && config.geometry.tubelet == 2, + "runtime.json geometry"); + expect(config.normalization.mean[1] == 0.456F && config.normalization.std[2] == 0.225F, + "runtime.json channel statistics"); + const std::map refused{ + {"a float where an integer belongs", replaced(kRuntimeJson, "16,", "16.0,")}, + {"a boolean where an integer belongs", + replaced(kRuntimeJson, "\"tubelet_size\": 2", "\"tubelet_size\": true")}, + {"a null where an integer belongs", replaced(kRuntimeJson, "224", "null")}, + {"a repeated key", + replaced(kRuntimeJson, "\"num_frames\": 16,", "\"num_frames\": 16, \"num_frames\": 18,")}, + {"an unknown key", replaced(kRuntimeJson, "{", "{\"norm_pix_loss\": false, ")}, + {"a missing key", replaced(kRuntimeJson, "\"patch_size\": 16, ", "")}, + {"a boolean statistic", replaced(kRuntimeJson, "0.485", "true")}, + {"two statistics", replaced(kRuntimeJson, ", 0.406]", "]")}, + {"a zero standard deviation", replaced(kRuntimeJson, "0.224", "0")}, + {"a statistic beyond float32", replaced(kRuntimeJson, "0.229", "1e300")}, + {"a standard deviation that overflows the normalization", + replaced(kRuntimeJson, "0.229", "1e-40")}, + {"an integer beyond int64", replaced(kRuntimeJson, "224", "18446744073709551615")}, + {"a negative frame count", replaced(kRuntimeJson, "16,", "-16,")}, + {"not an object", "[1, 2, 3]"}, + {"invalid JSON", "{\"num_frames\": 16"}, + }; + for (const auto& [name, text] : refused) + expect_throws([&] { trtmc::videomae::parse_runtime_config(text); }, + "runtime.json with " + name); +} + +// An engine stand-in that reports tensors the way the TensorRT module does: a dynamic +// input reports its opt shape, an output the shape inferred for the largest profile. +class FakeEngine final : public trtmc::ITrtModule { + public: + std::map>> inputs, outputs; + std::set dynamic; + std::map, std::vector> + profiles; + + trtmc::TensorMap forward(const trtmc::TensorMap&) override { return {}; } + trtmc::DeviceTensorMap forward_device(const trtmc::DeviceTensorMap&) override { return {}; } + void forward_device_async(const trtmc::DeviceTensorMap&) override {} + void forward_async(const trtmc::TensorMap&) override {} + void sync() override {} + cudaStream_t stream() const override { return nullptr; } + void enable_cuda_graph() override {} + bool cuda_graph_active() const override { return false; } + bool cuda_graph_captured() const override { return false; } + int32_t profile_idx() const override { return 0; } + std::vector input_info() const override { return info(inputs, true); } + std::vector output_info() const override { return info(outputs, false); } + bool has_input(const std::string& name) const override { return inputs.count(name) != 0; } + bool has_output(const std::string& name) const override { return outputs.count(name) != 0; } + trtmc::DType tensor_dtype(const std::string& name) const override { return find(name).first; } + std::vector tensor_shape(const std::string& name) const override { + return find(name).second; + } + std::vector input_profile_shape(const std::string& name, int32_t profile, + trtmc::ProfileShapeSelector selector) const override { + const auto found = profiles.find({name, selector}); + return profile == 0 && found != profiles.end() ? found->second : std::vector{}; + } + int32_t optimization_profile_count() const override { return 1; } + void* device_ptr(const std::string&) const override { return nullptr; } + void bind_external(const std::string&, void*) override {} + void bind_external(const std::string&, void*, const std::vector&) override {} + int32_t input_rank(const std::string& name) const override { + return static_cast(find(name).second.size()); + } + bool input_is_dynamic(const std::string& name) const override { + return inputs.count(name) != 0 && dynamic.count(name) != 0; + } + void reset_execution_context() override {} + void set_timing_label(std::string) override {} + bool ok() const override { return true; } + void keep_alive(std::shared_ptr) override {} + + private: + using Tensors = std::map>>; + static std::vector info(const Tensors& tensors, bool input) { + std::vector result; + for (const auto& [name, tensor] : tensors) + result.push_back({name, tensor.second, tensor.first, input}); + return result; + } + const std::pair>& find(const std::string& name) const { + const auto input = inputs.find(name); + return input != inputs.end() ? input->second : outputs.at(name); + } +}; + +FakeEngine checkpoint_engine() { + FakeEngine engine; + engine.inputs = {{"pixel_values", {trtmc::DType::kFloat32, {1, 16, 3, 224, 224}}}, + {"visible_index", {trtmc::DType::kInt32, {784}}}, + {"masked_index", {trtmc::DType::kInt32, {784}}}}; + engine.outputs = {{"logits", {trtmc::DType::kFloat32, {1, 1567, 1536}}}}; + engine.dynamic = {"visible_index", "masked_index"}; + for (const char* name : {"visible_index", "masked_index"}) { + engine.profiles[{name, trtmc::ProfileShapeSelector::kMin}] = {1}; + engine.profiles[{name, trtmc::ProfileShapeSelector::kOpt}] = {784}; + engine.profiles[{name, trtmc::ProfileShapeSelector::kMax}] = {1567}; + } + return engine; +} + +void engine_io() { + const ClipGeometry base{16, 224, 16, 2}; + const auto good = checkpoint_engine(); + trtmc::videomae::validate_engine(good, base); + std::map> defects{ + {"another frame size", [](FakeEngine& e) { e.inputs["pixel_values"].second[3] = 256; }}, + {"float16 pixels", + [](FakeEngine& e) { e.inputs["pixel_values"].first = trtmc::DType::kFloat16; }}, + {"float32 tube indices", + [](FakeEngine& e) { e.inputs["masked_index"].first = trtmc::DType::kFloat32; }}, + {"rank-2 tube indices", [](FakeEngine& e) { e.inputs["visible_index"].second = {1, 784}; }}, + {"a fixed-length tube index", + [](FakeEngine& e) { + e.dynamic.erase("masked_index"); + e.inputs["masked_index"].second = {160}; + }}, + {"a profile without a single visible tube", + [](FakeEngine& e) { + e.profiles[{"visible_index", trtmc::ProfileShapeSelector::kMin}] = {2}; + }}, + {"a profile short of tubes - 1 masked tubes", + [](FakeEngine& e) { + e.profiles[{"masked_index", trtmc::ProfileShapeSelector::kMax}] = {1408}; + }}, + {"another tube size", [](FakeEngine& e) { e.outputs["logits"].second[2] = 768; }}, + {"logits of a fixed masked length", + [](FakeEngine& e) { e.outputs["logits"].second[1] = 1408; }}, + {"a missing input", [](FakeEngine& e) { e.inputs.erase("masked_index"); }}, + {"an extra output", + [](FakeEngine& e) { e.outputs["features"] = {trtmc::DType::kFloat32, {1, 8}}; }}, + }; + for (const auto& [name, defect] : defects) { + auto engine = checkpoint_engine(); + defect(engine); + expect_throws([&] { trtmc::videomae::validate_engine(engine, base); }, + "an engine with " + name); + } +} + +} // namespace + +int main() { + geometry_layout(); + tube_selection(); + source_frames(); + normalization_layout(); + reconstruction(); + runtime_config(); + engine_io(); + if (failures) { + std::cerr << failures << " check(s) failed\n"; + return EXIT_FAILURE; + } + std::cout << "videomae clip checks passed\n"; + return EXIT_SUCCESS; +} diff --git a/families/videomae/tests/data/test_img.jpeg b/families/videomae/tests/data/test_img.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..095c03620f4efba781e30520da7f1462b08a6a30 GIT binary patch literal 55258 zcmb4KQ*b6gm;GWpnb_vUwry)-^NS|7ZTpLDYbLgxOl&)uVCS#h+I`;JUHx*qZr|#D z=+oz({#yOo0ieoC%18phzyJWSe+}@p0T2T~LO}edLqb48K|(@7!^1%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PIODVvJkOJS7;cf?fOB9Ax0*$ODXLbDniw6|54+9+TZXb82ux>4boB zgOimiS0|~?Hl{8uB!E1{^(c&?R$|8hWN)`px%0t3gc4sQ*22nUXD=Uk#9?qUazPvF zILAScI<n$G*YzXk1gVt8Rwo(pP8|HI$zLj_2@@a8E70{(7ay4Z7jiO>cVykW7wsD-03K zKgPQxcG6th0U21{-3w&ohlR+-agP@+TMV{2&@Q-qcRVvZK|?~a2vL^|<-&E;FcS&L zZaNz1Sz7GL!9I>SV+_RP4-N^_w=Q2jsd*KM8t_8&71a3G+1lHdJUVp|t-457Voq|o z8{==*x&6hLbu8%Q9_`Ap9Y{acw}jNTjNE9cc=pLWs7D}UBYn+TG+-m({s2xXPVZiH z;2))Goscf-e=){0Lo1!YJol#A4wB4r2O*k)+-GgDF-!nx+~=9Bl<@DrmT0;L8~_Nw z$vo>JFsxVtb3g!8+;5M1z)`E0UGh0m)pAaqur}Vj$?9@>PykvbDi4{g2v-CFzh1P$ zra@D-S0~pM?HZ1Hf&3@|Uh8gI^XrPobGZ6bYKyBF=6TjisuT~M`C@t67M*Mrlo830|e zk`BP`1pp7b*c@Py^{J}h0girjMrLg!om*sT-vY2e103_6IUKP-5eiPsGJOyCnwE{S zhks6WGNDFx<+jz8j9>yuEz8R^0TK^V30`?MG*hG(85(hwJdH<6t2TW1#TQPkEzc(d zBdq`oC?^c0 +#include +#include +#include +#include +#include +#include + +_Static_assert(sizeof(float) == 4, "frames and masks use float32"); + +static trtmc_string_view text(const char* value) { + const trtmc_string_view result = {value, (uint64_t)strlen(value)}; + return result; +} + +static uint64_t positive(const char* value) { + char* end = NULL; + const unsigned long long parsed = strtoull(value, &end, 10); + if (end == value || *end || !parsed || parsed > INT32_MAX) + return 0; + return (uint64_t)parsed; +} + +static int read_exact(const char* path, void* data, size_t bytes) { + FILE* file = fopen(path, "rb"); + int ok = file && fread(data, 1, bytes, file) == bytes && fgetc(file) == EOF && !ferror(file); + if (file) + fclose(file); + return ok; +} + +/* Runs a request that must be refused as an invalid argument. */ +static int refused(const trtmc_core_api_v1* core, + const trtmc_masked_video_text_to_video_api_v1* task, trtmc_model* model, + const trtmc_masked_video_text_to_video_request_v1* request, const char* name) { + trtmc_result* result = NULL; + trtmc_error* error = NULL; + const trtmc_status status = task->run(model, request, NULL, &result, &error); + core->result_release(result); + if (error) + core->error_release(error); + if (status != TRTMC_INVALID_ARGUMENT) { + fprintf(stderr, "request '%s' returned status %d instead of an invalid argument\n", name, + (int)status); + return 0; + } + return 1; +} + +int main(int argc, char** argv) { + const trtmc_core_api_v1* core = NULL; + const trtmc_api_header* header = NULL; + const trtmc_masked_video_text_to_video_api_v1* task = NULL; + trtmc_model* model = NULL; + trtmc_result* result = NULL; + trtmc_error* error = NULL; + trtmc_load_options_v1 options = {0}; + trtmc_masked_video_text_to_video_request_v1 request = {0}; + trtmc_video_result_view_v1 view = {0}; + trtmc_image_input_v1* inputs = NULL; + unsigned char* pixels = NULL; + float* mask = NULL; + float* empty = NULL; + FILE* output = NULL; + uint64_t frames, height, width, plane, values, i, j, field_count = 0; + size_t element; + int uint8_input, status = 1; + if (argc != 10) { + fprintf( + stderr, + "Usage: %s BUNDLE RUNTIME_ROOT FRAMES u8|f32 FRAME_COUNT HEIGHT WIDTH MASK OUTPUT\n", + argv[0]); + return 2; + } + uint8_input = strcmp(argv[4], "u8") == 0; + frames = positive(argv[5]); + height = positive(argv[6]); + width = positive(argv[7]); + if ((!uint8_input && strcmp(argv[4], "f32") != 0) || frames < 2 || !height || !width) { + fprintf(stderr, "invalid format or clip dimensions\n"); + return 2; + } + element = uint8_input ? sizeof(unsigned char) : sizeof(float); + /* Bound every product by division before forming it. */ + if (width > UINT64_MAX / height || + height * width > (uint64_t)(SIZE_MAX / 3 / sizeof(float)) / frames) { + fprintf(stderr, "clip size overflows host storage\n"); + return 2; + } + plane = height * width; + values = frames * plane * 3; + pixels = (unsigned char*)malloc((size_t)values * element); + mask = (float*)malloc((size_t)(frames * plane) * sizeof(float)); + empty = (float*)calloc((size_t)(frames * plane), sizeof(float)); + inputs = (trtmc_image_input_v1*)calloc((size_t)frames, sizeof(*inputs)); + if (!pixels || !mask || !empty || !inputs || + !read_exact(argv[3], pixels, (size_t)values * element) || + !read_exact(argv[8], mask, (size_t)(frames * plane) * sizeof(float))) { + fprintf(stderr, "frames and mask must hold exactly the stated clip\n"); + goto cleanup; + } + for (i = 0; i < frames; ++i) { + inputs[i].data = pixels + (size_t)(i * plane * 3) * element; + inputs[i].byte_size = plane * 3 * element; + inputs[i].height = (uint32_t)height; + inputs[i].width = (uint32_t)width; + inputs[i].channels = 3; + inputs[i].format = uint8_input ? TRTMC_IMAGE_UINT8 : TRTMC_IMAGE_FLOAT32; + } + if (trtmc_get_api(1, 0, &core) != TRTMC_OK || !core) { + fprintf(stderr, "unable to obtain the v1 C API\n"); + goto cleanup; + } + options.struct_size = sizeof(options); + options.runtime_root = text(argv[2]); + if (core->model_load(text(argv[1]), &options, &model, &error) != TRTMC_OK) + goto cleanup; + if (core->model_get_task_api(model, text(TRTMC_TASK_MASKED_VIDEO_TEXT_TO_VIDEO), 1, 0, &header, + &error) != TRTMC_OK) + goto cleanup; + if (!header || header->byte_size < sizeof(*task)) { + fprintf(stderr, "incomplete masked video C table\n"); + goto cleanup; + } + task = (const trtmc_masked_video_text_to_video_api_v1*)header; + if (core->config_field_count(model, text(TRTMC_TASK_MASKED_VIDEO_TEXT_TO_VIDEO), 1, 0, + &field_count, &error) != TRTMC_OK) + goto cleanup; + if (field_count != 0) { + fprintf(stderr, "videomae must expose no runtime Config fields\n"); + goto cleanup; + } + + request.source.frames = inputs; + request.source.frame_count = frames; + request.mask.values = mask; + request.mask.count = frames * plane; + request.mask.frames = frames; + request.mask.height = height; + request.mask.width = width; + request.prompt = text("a red car"); + if (!refused(core, task, model, &request, "prompt")) + goto cleanup; + request.prompt = text(""); + mask[0] = 1.0F - mask[0]; /* the first tube becomes mixed */ + if (!refused(core, task, model, &request, "mixed_tube")) + goto cleanup; + mask[0] = 1.0F - mask[0]; + request.mask.values = empty; + if (!refused(core, task, model, &request, "empty_mask")) + goto cleanup; + request.mask.values = mask; + request.source.frame_count = frames - 1; + request.mask.frames = frames - 1; + request.mask.count = (frames - 1) * plane; + if (!refused(core, task, model, &request, "frame_count")) + goto cleanup; + request.source.frame_count = frames; + request.mask.frames = frames; + request.mask.count = frames * plane; + + if (task->run(model, &request, NULL, &result, &error) != TRTMC_OK) + goto cleanup; + if (task->result_view(result, &view, &error) != TRTMC_OK) + goto cleanup; + if (view.frame_count != frames || view.conditioned_prefix_frames != 0 || + view.timestamps_seconds.size != 0) { + fprintf(stderr, "result must hold one frame per source frame and no timeline\n"); + goto cleanup; + } + output = fopen(argv[9], "wb"); + if (!output) { + fprintf(stderr, "cannot write %s\n", argv[9]); + goto cleanup; + } + for (i = 0; i < frames; ++i) { + const trtmc_image_result_view_v1* frame = &view.frames[i]; + if (frame->height != height || frame->width != width || frame->channels != 3 || + frame->pixel_count != plane * 3) { + fprintf(stderr, "result frame %" PRIu64 " has another shape\n", i); + goto cleanup; + } + for (j = 0; j < frame->pixel_count; ++j) + if (!(frame->pixels[j] >= 0.0F && frame->pixels[j] <= 1.0F)) { + fprintf(stderr, "result frame %" PRIu64 " leaves [0, 1]\n", i); + goto cleanup; + } + if (fwrite(frame->pixels, sizeof(float), (size_t)frame->pixel_count, output) != + (size_t)frame->pixel_count) { + fprintf(stderr, "cannot write %s\n", argv[9]); + goto cleanup; + } + } + if (fclose(output) != 0) { + output = NULL; + fprintf(stderr, "cannot write %s\n", argv[9]); + goto cleanup; + } + output = NULL; + printf("{\"task\":\"masked_video_text_to_video\",\"format\":\"%s\",\"frames\":%" PRIu64 + ",\"height\":%" PRIu64 ",\"width\":%" PRIu64 + ",\"channels\":3,\"conditioned_prefix_frames\":%" PRIu64 + ",\"timestamps_seconds\":[],\"refused\":[\"prompt\",\"mixed_tube\",\"empty_mask\"," + "\"frame_count\"],\"setup_ms\":%.17g,\"inference_ms\":%.17g}\n", + uint8_input ? "u8" : "f32", view.frame_count, height, width, + view.conditioned_prefix_frames, view.setup_ms, view.inference_ms); + status = fflush(stdout) == 0 && !ferror(stdout) ? 0 : 1; +cleanup: + if (error && core) { + const trtmc_string_view message = core->error_message(error); + fprintf(stderr, "C API error %d: ", (int)core->error_code(error)); + fwrite(message.data, 1, (size_t)message.size, stderr); + fputc('\n', stderr); + core->error_release(error); + } + if (core) { + core->result_release(result); + core->model_release(model); + } + if (output) + fclose(output); + free(inputs); + free(empty); + free(mask); + free(pixels); + return status; +} diff --git a/families/videomae/tests/sdk_consumer.cpp b/families/videomae/tests/sdk_consumer.cpp new file mode 100644 index 0000000000..a52dbc2780 --- /dev/null +++ b/families/videomae/tests/sdk_consumer.cpp @@ -0,0 +1,168 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +// Public C++ SDK consumer for the family-owned end-to-end test. +// +// Usage: BUNDLE RUNTIME_ROOT FRAMES u8|f32 FRAME_COUNT HEIGHT WIDTH MASK OUTPUT +// +// Same inputs as sdk_consumer.c. This consumer passes a timeline (frame i at +// i / 30 s), checks four requests the family must refuse, writes the THWC +// float32 result to OUTPUT and prints one JSON line. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +std::uint32_t positive(const char* argument) { + const std::string text(argument); + std::size_t consumed = 0; + const auto value = std::stoull(text, &consumed); + if (consumed != text.size() || !value || value > std::numeric_limits::max()) + throw std::invalid_argument("clip dimensions must be positive int32 values"); + return static_cast(value); +} + +template +std::vector read_exact(const char* path, std::size_t count) { + std::vector values(count); + std::ifstream file(path, std::ios::binary); + file.read(reinterpret_cast(values.data()), + static_cast(count * sizeof(Value))); + if (!file || file.peek() != std::char_traits::eof()) + throw std::runtime_error(std::string(path) + " does not hold exactly the stated clip"); + return values; +} + +void expect_refused(const std::string& name, const std::function& call) { + try { + call(); + } catch (const trtmc::Error& error) { + if (error.code() == TRTMC_INVALID_ARGUMENT) + return; + throw std::runtime_error("request '" + name + "' failed with status " + + std::to_string(static_cast(error.code())) + ": " + + error.what()); + } + throw std::runtime_error("request '" + name + "' was not refused"); +} + +} // namespace + +int main(int argc, char** argv) { + if (argc != 10) { + std::cerr << "Usage: " << argv[0] + << " BUNDLE RUNTIME_ROOT FRAMES u8|f32 FRAME_COUNT HEIGHT WIDTH MASK OUTPUT\n"; + return 2; + } + try { + const std::string format = argv[4]; + if (format != "u8" && format != "f32") + throw std::invalid_argument("format must be u8 or f32"); + const auto frames = positive(argv[5]), height = positive(argv[6]), + width = positive(argv[7]); + if (frames < 2) + throw std::invalid_argument("a clip needs at least two frames"); + // Bound every product by division before forming it; reads take a streamsize. + const auto limit = static_cast(std::numeric_limits::max()); + if (std::uint64_t{width} > limit / height || + std::uint64_t{height} * width > limit / 3 / sizeof(float) / frames) + throw std::invalid_argument("clip size overflows host storage"); + const std::size_t plane = std::size_t{height} * width; + const std::size_t values = std::size_t{frames} * plane * 3; + std::vector bytes; + std::vector floats; + if (format == "u8") + bytes = read_exact(argv[3], values); + else + floats = read_exact(argv[3], values); + auto mask = read_exact(argv[8], std::size_t{frames} * plane); + const std::vector empty(mask.size(), 0.0F); + + trtmc::LoadOptions options; + options.runtime_root = argv[2]; + auto model = trtmc::Model::load(argv[1], options); + const auto task = model.task(); + if (!task.config_fields().empty()) + throw std::runtime_error("videomae must expose no runtime Config fields"); + + trtmc::MaskedVideoTextToVideoRequest request; + for (std::uint32_t frame = 0; frame < frames; ++frame) { + const auto offset = std::size_t{frame} * plane * 3; + if (format == "u8") + request.source.frames.emplace_back( + trtmc::Span(bytes.data() + offset, plane * 3), height, + width); + else + request.source.frames.emplace_back( + trtmc::Span(floats.data() + offset, plane * 3), height, width); + request.source.timestamps_seconds.push_back(frame / 30.0); + } + request.mask = {{mask.data(), mask.size()}, frames, height, width}; + + request.prompt = "a red car"; + expect_refused("prompt", [&] { (void)task.run(request); }); + request.prompt.clear(); + mask[0] = 1.0F - mask[0]; // the first tube becomes mixed + expect_refused("mixed_tube", [&] { (void)task.run(request); }); + mask[0] = 1.0F - mask[0]; + request.mask.values = {empty.data(), empty.size()}; + expect_refused("empty_mask", [&] { (void)task.run(request); }); + request.mask.values = {mask.data(), mask.size()}; + auto shorter = request; + shorter.source.frames.pop_back(); + shorter.source.timestamps_seconds.pop_back(); + shorter.mask = {{mask.data(), mask.size() - plane}, frames - 1, height, width}; + expect_refused("frame_count", [&] { (void)task.run(shorter); }); + + const auto result = task.run(request); + const auto output = result.frames(); + const auto times = result.timestamps_seconds(); + if (output.size() != frames || result.conditioned_prefix_frames() != 0 || + times.size() != frames) + throw std::runtime_error("result must hold one frame and one time per source frame"); + std::ofstream file(argv[9], std::ios::binary); + for (std::size_t frame = 0; frame < output.size(); ++frame) { + const auto& image = output[frame]; + if (image.height != height || image.width != width || image.channels != 3 || + image.pixel_count != plane * 3) + throw std::runtime_error("a result frame has another shape"); + if (times[frame] != request.source.timestamps_seconds[frame]) + throw std::runtime_error("result frames must keep the source timeline"); + for (std::size_t i = 0; i < image.pixel_count; ++i) + if (!(image.pixels[i] >= 0.0F && image.pixels[i] <= 1.0F)) + throw std::runtime_error("a result frame leaves [0, 1]"); + file.write(reinterpret_cast(image.pixels), + static_cast(image.pixel_count * sizeof(float))); + } + file.close(); + if (!file) + throw std::runtime_error(std::string("cannot write ") + argv[9]); + + std::cout << std::setprecision(std::numeric_limits::max_digits10) + << "{\"task\":\"masked_video_text_to_video\",\"format\":\"" << format + << "\",\"frames\":" << output.size() << ",\"height\":" << height + << ",\"width\":" << width << ",\"channels\":3,\"conditioned_prefix_frames\":" + << result.conditioned_prefix_frames() << ",\"timestamps_seconds\":["; + for (std::size_t frame = 0; frame < times.size(); ++frame) + std::cout << (frame ? "," : "") << times[frame]; + std::cout << "],\"refused\":[\"prompt\",\"mixed_tube\",\"empty_mask\",\"frame_count\"]," + << "\"setup_ms\":" << result.setup_ms() + << ",\"inference_ms\":" << result.inference_ms() << "}\n"; + std::cout.flush(); + return std::cout ? 0 : 1; + } catch (const std::exception& error) { + std::cerr << error.what() << '\n'; + return 1; + } +} diff --git a/families/videomae/tests/test_e2e.py b/families/videomae/tests/test_e2e.py new file mode 100644 index 0000000000..088bbdd3fe --- /dev/null +++ b/families/videomae/tests/test_e2e.py @@ -0,0 +1,455 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Direct build, C and C++ SDK, and official-reference E2E for videomae. + +The shared CLI has no command for masked_video_text_to_video, so the native +path is the family's public SDK consumers (tests/sdk_consumer.c and .cpp). +Each case reconstructs the masked tubes of a 16-frame clip, a camera pan over +the test photograph, and checks: + +- the C consumer (8-bit frames) and the C++ consumer (the same pixels as + float32, with a timeline) return identical pixels; +- every conditioning tube keeps its source pixels exactly; +- every reconstructed pixel agrees with the reference: transformers' + VideoMAEForPreTraining in float32 with eager attention on the CPU, its + predictions turned into pixels the way the authors' visualization does + (``run_videomae_vis.py``: times the tube's source standard deviation plus + 1e-6, plus its source mean), clamped to [0, 1]; +- the reconstruction beats filling each masked tube with its mean, by as much + as the reference does. +""" + +from __future__ import annotations + +import json +import os +import subprocess +from pathlib import Path + +import numpy as np +from tensorrt_model_connect import BuildRequest, build +from tools.e2e_evidence import evidence_stage, record_evidence + +import pytest + +from families.videomae import config as config_module + +FAMILY = "videomae" +TASKS = frozenset({"masked_video_text_to_video"}) +TEST_ROOT = Path(__file__).resolve().parent +MANIFEST_ROOT = TEST_ROOT / "manifests" + +# Largest |native - reference| of a reconstructed pixel ([0, 1] scale). Measured +# on 1x B300, both cases, the same over four runs: 6.6e-6 (box) and 2.1e-5 (tube). +# Single defects injected into the reference move pixels by 8.9e-4 (biased variance +# in the restoration) to 1.0 (tanh GELU 1.7e-3 / 4.9e-3; q and v biases swapped, +# final encoder norm missing, tubes reordered: 0.86 or more); a decoder-norm epsilon +# of 1e-12 or a missing +1e-6 on the std (1.1e-5 to 1.9e-5) are below what any +# float32 pixel bound can resolve. +PIXEL_TOLERANCE = 1e-4 +# Reconstruction error over the masked tubes relative to filling each masked +# tube with its source mean (1.0 = no better than the mean). Measured: 0.33 (tube) +# and 0.20 (box), native and reference equal to 2e-7. +QUALITY_CEILING = 0.8 +QUALITY_AGREEMENT = 1e-3 + +# The clip: crops of the model's frame size from the test photograph, the +# window moving 2 pixels down and 8 right per frame. +PAN_ORIGIN = (60, 100) +PAN_STEP = (2, 8) +FRAME_RATE = 30.0 # the timeline the C++ consumer attaches + + +def _case_index() -> dict[str, tuple[Path, dict, dict]]: + result = {} + for path in sorted(MANIFEST_ROOT.glob("*.json")): + manifest = json.loads(path.read_text(encoding="utf-8")) + assert manifest["family"] == FAMILY + assert manifest["task"] in TASKS + for case in manifest["testcases"]: + name = str(case["name"]) + assert name not in result + result[name] = (path, manifest, case) + return result + + +CASES = _case_index() + + +def _selected_cases(config) -> tuple[list[str], bool]: + model_filters = set() + for raw in config.getoption("--e2e-model") or []: + model_filters.update(item.strip() for item in str(raw).split(",") if item.strip()) + models_file = config.getoption("--e2e-models-file") + if models_file: + model_filters.update( + line.strip() + for line in Path(models_file).read_text(encoding="utf-8").splitlines() + if line.strip() and not line.lstrip().startswith("#") + ) + testcase_filters = set() + for raw in config.getoption("--e2e-testcase") or []: + testcase_filters.update(item.strip() for item in str(raw).split(",") if item.strip()) + if not model_filters and not testcase_filters: + return sorted(CASES), False + selected = [] + for name, (_, manifest, _) in CASES.items(): + model_match = ( + not model_filters + or FAMILY in model_filters + or name in model_filters + or manifest["name"] in model_filters + ) + if model_match and (not testcase_filters or name in testcase_filters): + selected.append(name) + # Pytest skips an empty parametrization silently. A selection that names this + # family, one of its manifests or one of its cases and still matches nothing + # is an error; a selection of another family skips this file. + owned = {FAMILY} | set(CASES) | {manifest["name"] for _, manifest, _ in CASES.values()} + if not selected and model_filters & owned: + raise pytest.UsageError( + f"the E2E selection names {FAMILY} but matches none of its cases " + f"({', '.join(sorted(CASES))}); --e2e-testcase: {', '.join(sorted(testcase_filters))}") + return sorted(selected), True + + +def pytest_generate_tests(metafunc) -> None: + if "case_name" in metafunc.fixturenames: + names, enabled = _selected_cases(metafunc.config) + parameters = names + if not enabled: + parameters = [ + pytest.param( + name, + marks=pytest.mark.skip( + reason="direct E2E requires one of the three explicit E2E selectors" + ), + ) + for name in names + ] + metafunc.parametrize("case_name", parameters, ids=names) + + +def _required_path(value: str | None, label: str) -> Path: + assert value, f"selected {FAMILY} E2E requires {label}" + path = Path(value) + assert path.exists(), f"selected {FAMILY} E2E {label} does not exist: {path}" + return path + + +def _model_dir(manifest: dict) -> Path: + explicit = os.environ.get(f"TRTMC_{FAMILY.upper()}_MODEL_DIR") + if explicit: + return _required_path(explicit, f"TRTMC_{FAMILY.upper()}_MODEL_DIR") + from huggingface_hub import snapshot_download + + try: + # The family reads only these files; the checkpoint's pytorch_model.bin is never needed. + snapshot = snapshot_download( + repo_id=manifest["hf_id"], + revision=manifest.get("hf_revision"), + local_files_only=True, + allow_patterns=["config.json", "preprocessor_config.json", "model.safetensors"], + ) + except Exception as error: + raise AssertionError( + f"selected {FAMILY} E2E requires the exact cached checkpoint {manifest['hf_id']}" + ) from error + return Path(snapshot) + + +def _runtime(manifest: dict) -> tuple[Path, Path]: + runtime_root = _required_path(os.environ.get("TRTMC_RUNTIME_ROOT"), "TRTMC_RUNTIME_ROOT") + native_build = _required_path( + os.environ.get("TRTMC_NATIVE_BUILD_DIR"), "TRTMC_NATIVE_BUILD_DIR") + assert (runtime_root / "libtrtmc_backend_trt.so").is_file() + assert (runtime_root / f"libtrtmc_model_{FAMILY}.so").is_file() + assert int(manifest["tensor_parallel_size"]) == 1, "videomae runs on one GPU" + import torch + + assert torch.cuda.is_available(), f"selected {FAMILY} E2E requires CUDA" + return runtime_root, native_build + + +_BUNDLES: dict[str, Path] = {} + + +def _bundle(model_dir: Path, manifest: dict, tmp_path_factory) -> Path: + """Build each manifest's bundle once per session; its cases share it.""" + key = manifest["name"] + if key not in _BUNDLES: + bundle = tmp_path_factory.mktemp("bundle") / manifest["bundle"] + build( + BuildRequest( + model_dir=model_dir, + output_path=bundle, + family=FAMILY, + task=manifest["task"], + precision=manifest["precision"], + tensor_parallel_size=int(manifest["tensor_parallel_size"]), + ) + ) + _BUNDLES[key] = bundle + return _BUNDLES[key] + + +def _asset(raw: str) -> Path: + path = Path(raw) + if not path.is_absolute(): + path = TEST_ROOT / path + assert path.is_file(), f"selected {FAMILY} E2E asset does not exist: {path}" + record_evidence("inputs", {"asset": path}) + return path + + +def _clip(case: dict, cfg: dict) -> np.ndarray: + """``[frames, size, size, 3]`` uint8: a pan over the case's photograph.""" + from PIL import Image + + image = np.asarray(Image.open(_asset(case["clip_image"])).convert("RGB")) + size = cfg["image_size"] + frames = [] + for index in range(cfg["num_frames"]): + top = PAN_ORIGIN[0] + PAN_STEP[0] * index + left = PAN_ORIGIN[1] + PAN_STEP[1] * index + frame = image[top: top + size, left: left + size] + assert frame.shape == (size, size, 3), "the pan must stay inside the photograph" + frames.append(frame) + return np.ascontiguousarray(np.stack(frames)) + + +def _tube_mask(case: dict, cfg: dict) -> np.ndarray: + """One bool per tube, True where the tube is reconstructed.""" + spec = case["mask"] + grid, patch = cfg["grid"], cfg["patch_size"] + tubelets = cfg["num_frames"] // cfg["tubelet_size"] + if spec["kind"] == "tube": + # VideoMAE's tube masking: one random spatial pattern for every tubelet. + pattern = np.zeros(grid * grid, dtype=bool) + pattern[: int(spec["ratio"] * grid * grid)] = True + np.random.default_rng(int(spec["seed"])).shuffle(pattern) + return np.tile(pattern, tubelets) + assert spec["kind"] == "box", f"unknown mask kind {spec['kind']!r}" + # A box of whole patches in every frame. + box = [int(spec[key]) for key in ("top", "left", "height", "width")] + assert all(value % patch == 0 for value in box), "box edges must lie on the patch grid" + top, left, height, width = (value // patch for value in box) + pattern = np.zeros((grid, grid), dtype=bool) + pattern[top: top + height, left: left + width] = True + return np.tile(pattern.reshape(-1), tubelets) + + +def _pixel_mask(tubes: np.ndarray, cfg: dict) -> np.ndarray: + """``[frames, size, size]`` float32: the tube mask in the Task's FHW layout.""" + grid, patch, tubelet = cfg["grid"], cfg["patch_size"], cfg["tubelet_size"] + plane = tubes.reshape(-1, grid, grid) + plane = np.repeat(np.repeat(np.repeat(plane, tubelet, axis=0), patch, axis=1), patch, axis=2) + return np.ascontiguousarray(plane.astype(np.float32)) + + +def _rescaled(clip: np.ndarray) -> np.ndarray: + """The runtime's float view of 8-bit frames: double product with 1/255, then float32.""" + return (clip.astype(np.float64) * (1.0 / 255.0)).astype(np.float32) + + +def _sdk(native_build: Path, runtime_root: Path, bundle: Path, language: str, clip: np.ndarray, + pixel_mask: np.ndarray, case: dict, directory: Path) -> tuple[dict, np.ndarray]: + consumer = native_build / f"test_{FAMILY}_sdk_{language}" + assert consumer.is_file(), f"build the family-owned SDK consumer: {consumer.name}" + pixel_format = "u8" if language == "c" else "f32" + frames_path = directory / f"frames-{language}.{pixel_format}" + (clip if pixel_format == "u8" else _rescaled(clip)).tofile(frames_path) + mask_path = directory / "mask.f32" + pixel_mask.tofile(mask_path) + output = directory / f"result-{language}.f32" + env = os.environ.copy() + env["LD_LIBRARY_PATH"] = ":".join( + value for value in (str(runtime_root), env.get("LD_LIBRARY_PATH", "")) if value) + frames, size = clip.shape[0], clip.shape[1] + completed = subprocess.run( + [str(consumer), str(bundle), str(runtime_root), str(frames_path), pixel_format, + str(frames), str(size), str(size), str(mask_path), str(output)], + check=True, + capture_output=True, + text=True, + env=env, + timeout=int(case.get("runtime_timeout_s", 3600)), + ) + record_evidence(f"sdk_{language}_process", + {"argv": completed.args, "stdout": completed.stdout, "stderr": completed.stderr}) + payloads = [json.loads(line) for line in completed.stdout.splitlines() if line.startswith("{")] + assert len(payloads) == 1, f"SDK {language} consumer must print one result" + pixels = np.fromfile(output, dtype=np.float32) + assert pixels.size == clip.size, f"SDK {language} consumer wrote another clip size" + return payloads[0], pixels.reshape(clip.shape) + + +def _official_reference(model_dir: Path, clip: np.ndarray, tubes: np.ndarray, + cfg: dict) -> np.ndarray: + """Reference pixels: transformers' prediction, restored as the authors' visualization does.""" + import torch + from transformers import VideoMAEForPreTraining, VideoMAEImageProcessor + from transformers.utils.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD + + processor = VideoMAEImageProcessor.from_pretrained(model_dir) + pixel_values = processor(list(clip), return_tensors="pt")["pixel_values"] + model = VideoMAEForPreTraining.from_pretrained( + model_dir, attn_implementation="eager", dtype=torch.float32).eval() + masked = torch.from_numpy(tubes) + with torch.no_grad(): + logits = model(pixel_values, bool_masked_pos=masked[None]).logits[0] + + # The modeling code and the visualization undo the input normalization with + # these constants; the checkpoint's processor uses the same statistics. + assert list(processor.image_mean) == list(IMAGENET_DEFAULT_MEAN) + assert list(processor.image_std) == list(IMAGENET_DEFAULT_STD) + mean = torch.tensor(IMAGENET_DEFAULT_MEAN).view(1, 1, 3, 1, 1) + std = torch.tensor(IMAGENET_DEFAULT_STD).view(1, 1, 3, 1, 1) + frames = pixel_values * std + mean + count, size = cfg["num_frames"], cfg["image_size"] + tubelet, patch, grid = cfg["tubelet_size"], cfg["patch_size"], cfg["grid"] + patches = frames.view(1, count // tubelet, tubelet, 3, grid, patch, grid, patch) + patches = patches.permute(0, 1, 4, 6, 2, 5, 7, 3).reshape(cfg["tubes"], -1, 3) + center = patches.mean(dim=-2, keepdim=True) + scale = patches.var(dim=-2, unbiased=True, keepdim=True).sqrt() + 1e-6 + restored = patches.clone() + restored[masked] = logits.view(int(masked.sum()), -1, 3) * scale[masked] + center[masked] + restored = restored.clamp(0.0, 1.0).view(1, count // tubelet, grid, grid, tubelet, patch, patch, 3) + return restored.permute(0, 1, 4, 2, 5, 3, 6, 7).reshape(count, size, size, 3).numpy() + + +def _tube_means(source: np.ndarray, cfg: dict) -> np.ndarray: + """Each tube's per-channel source mean, broadcast over the tube's pixels.""" + count, size = cfg["num_frames"], cfg["image_size"] + tubelet, patch, grid = cfg["tubelet_size"], cfg["patch_size"], cfg["grid"] + tubes = source.astype(np.float64).reshape(count // tubelet, tubelet, grid, patch, grid, patch, 3) + means = tubes.mean(axis=(1, 3, 5), keepdims=True) + return np.broadcast_to(means, tubes.shape).reshape(count, size, size, 3) + + +def _quality(result: np.ndarray, source: np.ndarray, baseline: np.ndarray, + selected: np.ndarray) -> float: + error = np.mean((result.astype(np.float64)[selected] - source[selected]) ** 2) + return float(error / np.mean((baseline[selected] - source[selected]) ** 2)) + + +def _bytes(frames: np.ndarray) -> np.ndarray: + if frames.dtype == np.uint8: + return frames + return np.round(np.clip(frames, 0.0, 1.0) * 255.0).astype(np.uint8) + + +def _sheet(frames: np.ndarray, path: Path) -> Path: + """The clip as one PNG, four frames per row, for the evidence report.""" + from PIL import Image + + pixels = _bytes(frames) + count, height, width, _ = pixels.shape + columns = 4 + sheet = np.zeros((-(-count // columns) * height, columns * width, 3), dtype=np.uint8) + for index, frame in enumerate(pixels): + row, column = divmod(index, columns) + sheet[row * height:(row + 1) * height, column * width:(column + 1) * width] = frame + Image.fromarray(sheet).save(path) + return path + + +def _animation(frames: np.ndarray, path: Path) -> Path: + """The clip as an animated GIF, for the evidence report.""" + from PIL import Image + + images = [Image.fromarray(frame) for frame in _bytes(frames)] + images[0].save(path, save_all=True, append_images=images[1:], duration=125, loop=0) + return path + + +def test_official_checkpoint_e2e(case_name: str, tmp_path: Path, tmp_path_factory) -> None: + _, manifest, case = CASES[case_name] + record_evidence("inputs", {"manifest": manifest, "case": case}) + record_evidence("thresholds", {"pixel_tolerance": PIXEL_TOLERANCE, + "quality_ceiling": QUALITY_CEILING, + "quality_agreement": QUALITY_AGREEMENT}) + model_dir = _model_dir(manifest) + record_evidence("checkpoint", {"model_dir": str(model_dir), "hf_id": manifest.get("hf_id"), + "hf_revision": manifest.get("hf_revision")}) + runtime_root, native_build = _runtime(manifest) + cfg = config_module.resolve(model_dir) + with evidence_stage("build"): + bundle = _bundle(model_dir, manifest, tmp_path_factory) + + clip = _clip(case, cfg) + tubes = _tube_mask(case, cfg) + pixel_mask = _pixel_mask(tubes, cfg) + source = _rescaled(clip) + # What the model sees: the reconstructed tubes are shown gray. + shown = np.where(pixel_mask[..., None] > 0, np.float32(0.5), source) + record_evidence("inputs", {"clip": _animation(clip, tmp_path / "input.gif"), + "frames": _sheet(clip, tmp_path / "input.png"), + "conditioning_tubes": _sheet(shown, tmp_path / "conditioning.png"), + "reconstructed_tubes": int(tubes.sum()), "tubes": int(tubes.size)}) + with evidence_stage("native"): + c_payload, c_pixels = _sdk(native_build, runtime_root, bundle, "c", clip, pixel_mask, + case, tmp_path) + cpp_payload, cpp_pixels = _sdk(native_build, runtime_root, bundle, "cpp", clip, + pixel_mask, case, tmp_path) + native_frames = _sheet(c_pixels, tmp_path / "native.png") + record_evidence("native", {"video": _animation(c_pixels, tmp_path / "native.gif"), + "frames": native_frames, "c": c_payload, "cpp": cpp_payload}) + with evidence_stage("reference"): + expected = _official_reference(model_dir, clip, tubes, cfg) + reference_frames = _sheet(expected, tmp_path / "reference.png") + record_evidence("reference", { + "video": _animation(expected, tmp_path / "reference.gif"), "frames": reference_frames, + "implementation": "transformers VideoMAEForPreTraining, float32, eager attention, CPU; " + "masked tubes restored with their source mean and standard deviation"}) + + with evidence_stage("compare"): + count, size = cfg["num_frames"], cfg["image_size"] + for payload, timeline in ((c_payload, []), + (cpp_payload, [index / FRAME_RATE for index in range(count)])): + assert payload["task"] == "masked_video_text_to_video" + assert (payload["frames"], payload["height"], payload["width"], payload["channels"]) == ( + count, size, size, 3) + assert payload["conditioned_prefix_frames"] == 0 + assert payload["timestamps_seconds"] == timeline + assert payload["refused"] == ["prompt", "mixed_tube", "empty_mask", "frame_count"] + assert c_pixels.shape == cpp_pixels.shape == expected.shape == source.shape + + reconstructed = pixel_mask.astype(bool)[..., None].repeat(3, axis=-1) + consumers_agree = bool(np.array_equal(c_pixels, cpp_pixels)) + conditioning_kept = bool(np.array_equal(c_pixels[~reconstructed], source[~reconstructed])) + error = float(np.max(np.abs(c_pixels[reconstructed] - expected[reconstructed]))) + baseline = _tube_means(source, cfg) + native_quality = _quality(c_pixels, source, baseline, reconstructed) + reference_quality = _quality(expected, source, baseline, reconstructed) + quality_gap = abs(native_quality - reference_quality) + record_evidence("reference_comparison", { + "label": f"{case_name}: reconstructed clip", + "scope": "independent_reference", + "enforced": True, + "native": native_frames, + "reference": reference_frames, + "checks": [ + {"name": "max_abs_pixel_error", "label": "Largest |native - reference| pixel", + "scope": "independent_reference", "actual": error, "operator": "<=", + "expected": PIXEL_TOLERANCE, "passed": error <= PIXEL_TOLERANCE}, + {"name": "quality_gap", "label": "|native - reference| error relative to tube means", + "scope": "independent_reference", "actual": quality_gap, "operator": "<=", + "expected": QUALITY_AGREEMENT, "passed": quality_gap <= QUALITY_AGREEMENT}, + {"name": "quality", "label": "Native error relative to filling tubes with their mean", + "scope": "contract", "actual": native_quality, "operator": "<=", + "expected": QUALITY_CEILING, "passed": native_quality <= QUALITY_CEILING}, + {"name": "conditioning_kept", "label": "Conditioning tubes keep their source pixels", + "scope": "contract", "actual": conditioning_kept, "operator": "==", + "expected": True, "passed": conditioning_kept}, + {"name": "consumers_agree", "label": "C and C++ consumers return identical pixels", + "scope": "contract", "actual": consumers_agree, "operator": "==", + "expected": True, "passed": consumers_agree}, + ], + }) + assert consumers_agree, "C and C++ consumers disagree" + assert conditioning_kept, "conditioning tubes must keep their source pixels" + assert error <= PIXEL_TOLERANCE, error + assert native_quality <= QUALITY_CEILING, native_quality + assert quality_gap <= QUALITY_AGREEMENT, quality_gap diff --git a/families/videomae/tests/test_model.py b/families/videomae/tests/test_model.py new file mode 100644 index 0000000000..fb199eeecd --- /dev/null +++ b/families/videomae/tests/test_model.py @@ -0,0 +1,469 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Builder contract and graph parity of the videomae family. + +The CPU tests cover the configuration and request checks. The GPU tests build +the engine of small random VideoMAE checkpoints and compare its logits with +transformers' VideoMAEForPreTraining in float32 for several tube selections. +""" + +from __future__ import annotations + +import json +from pathlib import Path + +import numpy as np +import pytest + +from families.videomae import config as config_module, graph, model + +# config.json and preprocessor_config.json of MCG-NJU/videomae-base at the pinned revision. +BASE_CONFIG = { + "architectures": ["VideoMAEForPreTraining"], + "attention_probs_dropout_prob": 0.0, + "decoder_hidden_size": 384, + "decoder_intermediate_size": 1536, + "decoder_num_attention_heads": 6, + "decoder_num_hidden_layers": 4, + "hidden_act": "gelu", + "hidden_dropout_prob": 0.0, + "hidden_size": 768, + "image_size": 224, + "initializer_range": 0.02, + "intermediate_size": 3072, + "layer_norm_eps": 1e-12, + "model_type": "videomae", + "norm_pix_loss": True, + "num_attention_heads": 12, + "num_channels": 3, + "num_frames": 16, + "num_hidden_layers": 12, + "patch_size": 16, + "qkv_bias": True, + "torch_dtype": "float32", + "transformers_version": "4.22.0.dev0", + "tubelet_size": 2, + "use_mean_pooling": False, +} +BASE_PROCESSOR = { + "do_center_crop": True, + "do_normalize": True, + "do_resize": True, + "feature_extractor_type": "VideoMAEFeatureExtractor", + "image_mean": [0.485, 0.456, 0.406], + "image_std": [0.229, 0.224, 0.225], + "resample": 2, + "size": 224, +} + + +def _write(directory: Path, config: dict, processor: dict) -> Path: + directory.mkdir(parents=True, exist_ok=True) + (directory / "config.json").write_text(json.dumps(config), encoding="utf-8") + (directory / "preprocessor_config.json").write_text(json.dumps(processor), encoding="utf-8") + return directory + + +def test_base_checkpoint_configuration(tmp_path): + cfg = config_module.resolve(_write(tmp_path, BASE_CONFIG, BASE_PROCESSOR)) + assert (cfg["num_frames"], cfg["image_size"], cfg["patch_size"], cfg["tubelet_size"]) == ( + 16, 224, 16, 2) + assert (cfg["grid"], cfg["tubes"], cfg["tube_values"]) == (14, 1568, 1536) + assert cfg["encoder"] == {"width": 768, "heads": 12, "layers": 12, "intermediate": 3072} + assert cfg["decoder"] == {"width": 384, "heads": 6, "layers": 4, "intermediate": 1536} + assert cfg["layer_norm_eps"] == 1e-12 and cfg["final_layernorm"] is True + assert cfg["image_mean"] == [0.485, 0.456, 0.406] + assert cfg["image_std"] == [0.229, 0.224, 0.225] + + +def test_omitted_keys_take_the_transformers_defaults(tmp_path): + config = {"architectures": ["VideoMAEForPreTraining"], "model_type": "videomae"} + cfg = config_module.resolve(_write(tmp_path, config, {})) + # VideoMAEConfig defaults use_mean_pooling to true: no final encoder norm. + assert cfg["final_layernorm"] is False + assert cfg["tubes"] == 1568 + # VideoMAEImageProcessor defaults its statistics to 0.5. + assert cfg["image_mean"] == [0.5, 0.5, 0.5] and cfg["image_std"] == [0.5, 0.5, 0.5] + + +@pytest.mark.parametrize( + ("change", "message"), + [ + ({"norm_pix_loss": False}, "norm_pix_loss"), + ({"hidden_act": "gelu_new"}, "hidden_act"), + ({"qkv_bias": False}, "qkv_bias"), + ({"num_channels": 1}, "num_channels"), + ({"image_size": [224, 160]}, "square image_size"), + ], +) +def test_unreproduced_model_flags_are_refused(tmp_path, change, message): + with pytest.raises(NotImplementedError, match=message): + config_module.resolve(_write(tmp_path, {**BASE_CONFIG, **change}, BASE_PROCESSOR)) + + +@pytest.mark.parametrize( + "change", + [ + {"architectures": ["VideoMAEForVideoClassification"]}, + {"model_type": "vit_mae"}, + {"num_frames": 15}, + {"patch_size": 15}, + {"hidden_size": 770}, + {"layer_norm_eps": 0}, + {"layer_norm_eps": None}, + {"use_mean_pooling": None}, + {"architectures": "VideoMAEForPreTraining"}, + {"image_size": [224, 224.0]}, + {"num_frames": 16.0}, + # 0 and infinity once the graph stores them in float32. + {"layer_norm_eps": 1e-100}, + {"layer_norm_eps": 1e100}, + ], +) +def test_invalid_model_configurations_are_refused(tmp_path, change): + with pytest.raises(ValueError): + config_module.resolve(_write(tmp_path, {**BASE_CONFIG, **change}, BASE_PROCESSOR)) + + +@pytest.mark.parametrize( + "change", + [ + {"do_resize": None}, + {"do_normalize": None}, + {"rescale_factor": True}, + {"image_mean": [0.485, True, 0.406]}, + {"image_std": [0.229, 0.224, None]}, + {"size": {"shortest_edge": 224.0}}, + {"crop_size": {"height": 224, "width": True}}, + # Finite and positive, yet (pixel - mean) / std overflows float32. + {"image_std": [0.229, 0.224, 1e-40]}, + {"image_mean": [0.485, 0.456, 1e300]}, + # Infinite in float32, which the runtime refuses to load. + {"image_std": [0.229, 0.224, 1e300]}, + ], +) +def test_mistyped_processor_values_are_refused(tmp_path, change): + with pytest.raises(ValueError): + config_module.resolve(_write(tmp_path, BASE_CONFIG, {**BASE_PROCESSOR, **change})) + + +@pytest.mark.parametrize("name", ["config.json", "preprocessor_config.json"]) +def test_repeated_json_keys_are_refused(tmp_path, name): + _write(tmp_path, BASE_CONFIG, BASE_PROCESSOR) + path = tmp_path / name + text = path.read_text(encoding="utf-8") + path.write_text(text[:-1] + ', "do_resize": true, "model_type": "videomae"}', encoding="utf-8") + with pytest.raises(ValueError, match="repeated JSON keys"): + config_module.resolve(tmp_path) + + +@pytest.mark.parametrize( + "change", + [ + {"size": 256}, + {"size": {"height": 256, "width": 224}}, + {"crop_size": {"height": 200, "width": 200}}, + {"do_rescale": False}, + {"rescale_factor": 1 / 127.5}, + {"do_normalize": False}, + ], +) +def test_processors_that_change_a_model_size_clip_are_refused(tmp_path, change): + with pytest.raises(NotImplementedError): + config_module.resolve(_write(tmp_path, BASE_CONFIG, {**BASE_PROCESSOR, **change})) + + +def test_processor_without_resize_or_crop_keeps_model_size_clips(tmp_path): + processor = {**BASE_PROCESSOR, "do_resize": False, "do_center_crop": False, "size": 512} + assert config_module.resolve(_write(tmp_path, BASE_CONFIG, processor))["image_size"] == 224 + + +def test_sinusoid_table_matches_the_reference_bit_for_bit(): + from transformers.models.videomae.modeling_videomae import get_sinusoid_encoding_table + + for positions, width in ((1568, 768), (1568, 384), (32, 64)): + expected = get_sinusoid_encoding_table(positions, width)[0].numpy() + actual = graph.sinusoid_table(positions, width) + assert actual.dtype == np.float32 and np.array_equal(actual, expected) + + +class _Options: + """The E2E selector options of a pytest configuration.""" + + def __init__(self, **values): + self.values = values + + def getoption(self, name): + return self.values.get(name) + + +@pytest.mark.parametrize( + ("options", "expected"), + [ + ({}, (["videomae-base-box-mask", "videomae-base-tube-mask"], False)), + ({"--e2e-model": ["videomae"]}, (["videomae-base-box-mask", "videomae-base-tube-mask"], True)), + ({"--e2e-model": ["videomae"], "--e2e-testcase": ["videomae-base-box-mask"]}, + (["videomae-base-box-mask"], True)), + ({"--e2e-testcase": ["videomae-base-tube-mask"]}, (["videomae-base-tube-mask"], True)), + # A selection of another family skips this file. + ({"--e2e-model": ["bert"]}, ([], True)), + ({"--e2e-testcase": ["bert-base-uncased"]}, ([], True)), + ], +) +def test_e2e_selection(options, expected): + from families.videomae.tests import test_e2e + + assert test_e2e._selected_cases(_Options(**options)) == expected + + +@pytest.mark.parametrize( + "options", + [ + {"--e2e-model": ["videomae"], "--e2e-testcase": ["videomae-base-typo"]}, + {"--e2e-model": ["videomae-base"], "--e2e-testcase": ["videomae-base-typo"]}, + {"--e2e-model": ["videomae-base-tube-mask"], "--e2e-testcase": ["videomae-base-box-mask"]}, + ], +) +def test_e2e_selection_that_names_the_family_but_matches_nothing_fails(options): + from families.videomae.tests import test_e2e + + with pytest.raises(pytest.UsageError, match="matches none of its cases"): + test_e2e._selected_cases(_Options(**options)) + + +def test_e2e_selection_from_a_models_file_that_matches_nothing_fails(tmp_path): + from families.videomae.tests import test_e2e + + models = tmp_path / "models.txt" + models.write_text("# selected families\nvideomae\n", encoding="utf-8") + with pytest.raises(pytest.UsageError, match="matches none of its cases"): + test_e2e._selected_cases(_Options(**{"--e2e-models-file": str(models), + "--e2e-testcase": ["videomae-base-typo"]})) + + +class _Writer: + """Records what a build would write, so request checks can run without a GPU.""" + + def __init__(self): + self.sections = {} + + def set_header(self, **header): + self.header = header + + def add_bytes(self, name, data): + self.sections[name] = data + + def add_json(self, name, value): + self.sections[name] = value + + +@pytest.mark.parametrize( + ("change", "error"), + [ + ({"task": "text_to_video"}, ValueError), + ({"backend": "trt_rtx"}, ValueError), + ({"precision": "fp16"}, NotImplementedError), + ({"quantization": "fp8"}, NotImplementedError), + ({"fp32_layers": (1,)}, NotImplementedError), + ({"max_batch_size": 2}, NotImplementedError), + ({"tensor_parallel_size": 2}, NotImplementedError), + ({"context_parallel_size": 2}, NotImplementedError), + ({"dynamic_kv_cache": True}, NotImplementedError), + ({"mtp_seq_len": 2}, NotImplementedError), + ({"max_sequence_length": 1568}, NotImplementedError), + ({"image_height": 256}, NotImplementedError), + ({"image_width": 160}, NotImplementedError), + ({"video_num_frames": 32}, NotImplementedError), + # Fractional or float sizes are refused, not truncated. + ({"video_num_frames": 16.5}, ValueError), + ({"image_height": 224.0}, ValueError), + ({"max_batch_size": 1.0}, ValueError), + ], +) +def test_unsupported_build_requests_are_refused_before_the_engine(tmp_path, change, error): + from tensorrt_model_connect import BuildRequest + + request = BuildRequest(**{ + "model_dir": _write(tmp_path / "model", BASE_CONFIG, BASE_PROCESSOR), + "output_path": tmp_path / "videomae.bundle", + "family": "videomae", + "task": "masked_video_text_to_video", + "precision": "fp32", + **change, + }) + writer = _Writer() + with pytest.raises(error): + model.build(request, writer) + assert writer.sections == {} + + +# Small random checkpoints for the graph test: 4 frames of 32x32 pixels in +# 2x8x8 tubes (32 tubes), with and without the final encoder norm. +TINY_CONFIG = { + **BASE_CONFIG, + "image_size": 32, + "patch_size": 8, + "num_frames": 4, + "hidden_size": 64, + "num_hidden_layers": 2, + "num_attention_heads": 4, + "intermediate_size": 96, + "decoder_hidden_size": 32, + "decoder_num_hidden_layers": 2, + "decoder_num_attention_heads": 2, + "decoder_intermediate_size": 48, +} +TINY_PROCESSOR = {**BASE_PROCESSOR, "size": 32, "crop_size": 32} + + +def _tiny_checkpoint(directory: Path, use_mean_pooling: bool, seed: int): + import torch + from transformers import VideoMAEConfig, VideoMAEForPreTraining + + torch.manual_seed(seed) + reference = VideoMAEForPreTraining(VideoMAEConfig( + **{**TINY_CONFIG, "use_mean_pooling": use_mean_pooling}, attn_implementation="eager")) + # The default initialization (std 0.02, unit norms, zero biases) would hide + # mistakes in the norms and biases, so every tensor gets a random value. + with torch.no_grad(): + for parameter in reference.parameters(): + parameter.copy_(torch.randn_like(parameter) * 0.3) + reference.save_pretrained(directory) + _write(directory, json.loads((directory / "config.json").read_text()), TINY_PROCESSOR) + return reference.eval() + + +def test_checkpoint_tensors_are_checked_before_the_engine(tmp_path): + _tiny_checkpoint(tmp_path, use_mean_pooling=False, seed=3) + cfg = config_module.resolve(tmp_path) + weights = model._open_checkpoint(tmp_path, cfg) + model._require_weights(weights, cfg) + + missing = dict(weights) + del missing["decoder.norm.bias"] + with pytest.raises(KeyError, match="missing expected tensors: decoder.norm.bias"): + model._require_weights(missing, cfg) + extra = {**weights, "decoder.extra.weight": weights["decoder.norm.bias"]} + with pytest.raises(KeyError, match="does not run: decoder.extra.weight"): + model._require_weights(extra, cfg) + half = {**weights, "mask_token": weights["mask_token"].astype(np.float16)} + with pytest.raises(TypeError, match="float32 checkpoints only: mask_token"): + model._require_weights(half, cfg) + reshaped = {**weights, "mask_token": np.zeros((1, 2, cfg["decoder"]["width"]), np.float32)} + with pytest.raises(ValueError, match="mask_token"): + model._require_weights(reshaped, cfg) + # A bias that would broadcast, and an MLP that disagrees with the configuration. + bias = "videomae.encoder.layer.0.attention.attention.q_bias" + with pytest.raises(ValueError, match=bias): + model._require_weights({**weights, bias: np.zeros((1,), np.float32)}, cfg) + mlp = "decoder.decoder_layers.1.intermediate.dense.weight" + wider = np.zeros((cfg["decoder"]["intermediate"] + 8, cfg["decoder"]["width"]), np.float32) + with pytest.raises(ValueError, match=mlp): + model._require_weights({**weights, mlp: wider}, cfg) + + +def test_checkpoint_header_is_checked_before_any_tensor_is_read(tmp_path, monkeypatch): + import safetensors + from safetensors.numpy import save_file + + _tiny_checkpoint(tmp_path, use_mean_pooling=False, seed=3) + cfg = config_module.resolve(tmp_path) + weights = model._open_checkpoint(tmp_path, cfg) + bias = "decoder.decoder_layers.0.attention.attention.v_bias" + save_file({**weights, bias: np.zeros((1,), np.float32)}, str(tmp_path / "model.safetensors")) + opened, read = [], [] + real_open = safetensors.safe_open + + class Recording: + """safe_open that records the files it opens and the tensors whose data it reads.""" + + def __init__(self, path, **options): + opened.append(path) + self._handle = real_open(path, **options) + + def __enter__(self): + self._handle.__enter__() + return self + + def __exit__(self, *details): + return self._handle.__exit__(*details) + + def keys(self): + return self._handle.keys() + + def get_slice(self, key): + return self._handle.get_slice(key) + + def get_tensor(self, key): + read.append(key) + return self._handle.get_tensor(key) + + monkeypatch.setattr(safetensors, "safe_open", Recording) + with pytest.raises(ValueError, match=bias): + model._open_checkpoint(tmp_path, cfg) + assert opened == [str(tmp_path / "model.safetensors")] + assert read == [] + +def _selections(tubes: int, rng: np.random.Generator): + per_tubelet = tubes // 2 + tube_mask = np.zeros(per_tubelet, dtype=bool) + tube_mask[: int(0.9 * per_tubelet)] = True + rng.shuffle(tube_mask) + single_visible = np.ones(tubes, dtype=bool) + single_visible[rng.integers(tubes)] = False + single_masked = np.zeros(tubes, dtype=bool) + single_masked[rng.integers(tubes)] = True + return { + "tube_90": np.tile(tube_mask, 2), + "random_half": rng.permutation(np.arange(tubes) % 2 == 0), + "one_visible": single_visible, + "one_masked": single_masked, + } + + +def _run_plan(plan: bytes, feeds: dict) -> np.ndarray: + import tensorrt as trt + import torch + + engine = trt.Runtime(trt.Logger(trt.Logger.WARNING)).deserialize_cuda_engine(plan) + context = engine.create_execution_context() + stream = torch.cuda.current_stream() + buffers = {} + for name, value in feeds.items(): + buffers[name] = torch.from_numpy(np.ascontiguousarray(value)).cuda() + assert context.set_input_shape(name, tuple(buffers[name].shape)) + context.set_tensor_address(name, buffers[name].data_ptr()) + logits = torch.empty(tuple(context.get_tensor_shape("logits")), dtype=torch.float32, + device="cuda") + context.set_tensor_address("logits", logits.data_ptr()) + assert context.execute_async_v3(stream.cuda_stream) + stream.synchronize() + return logits.cpu().numpy() + + +@pytest.mark.gpu +@pytest.mark.trt +@pytest.mark.parametrize("use_mean_pooling", [False, True], ids=["final-norm", "no-final-norm"]) +def test_engine_logits_match_transformers_float32(tmp_path, use_mean_pooling): + import torch + + reference = _tiny_checkpoint(tmp_path, use_mean_pooling, seed=7) + cfg = config_module.resolve(tmp_path) + weights = model._open_checkpoint(tmp_path, cfg) + plan = model.build_engine(weights, cfg) + + rng = np.random.default_rng(11) + pixel_values = rng.standard_normal((1, 4, 3, 32, 32)).astype(np.float32) + for name, masked in _selections(cfg["tubes"], rng).items(): + with torch.no_grad(): + expected = reference(torch.from_numpy(pixel_values), + bool_masked_pos=torch.from_numpy(masked)[None]).logits.numpy() + actual = _run_plan(plan, { + "pixel_values": pixel_values, + "visible_index": np.flatnonzero(~masked).astype(np.int32), + "masked_index": np.flatnonzero(masked).astype(np.int32), + }) + assert actual.shape == expected.shape == (1, int(masked.sum()), cfg["tube_values"]), name + error = float(np.max(np.abs(actual - expected))) + assert error <= 1e-4 * max(1.0, float(np.max(np.abs(expected)))), (name, error) diff --git a/families/videomae/tests/test_support.py b/families/videomae/tests/test_support.py new file mode 100644 index 0000000000..b890c89105 --- /dev/null +++ b/families/videomae/tests/test_support.py @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Dependency-free semantic Task discovery for VideoMAE.""" + +from families.videomae.support import describe +from tensorrt_model_connect.model_support import ModelMetadata + + +def _metadata(model_type: str, architecture: str) -> ModelMetadata: + return ModelMetadata(config={"model_type": model_type, "architectures": [architecture]}, + model_index={}) + + +def test_pretraining_checkpoint_selects_masked_video_reconstruction(): + support = describe(_metadata("videomae", "VideoMAEForPreTraining")) + assert support is not None + assert support.tasks == ("masked_video_text_to_video",) + assert support.default_task == "masked_video_text_to_video" + assert support.default_precision == "fp32" + + +def test_heads_without_the_pixel_decoder_are_not_claimed(): + assert describe(_metadata("videomae", "VideoMAEForVideoClassification")) is None + assert describe(_metadata("videomae", "VideoMAEModel")) is None + assert describe(_metadata("vit_mae", "ViTMAEForPreTraining")) is None