/* * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ #include "families/vivit/runtime/pipeline.h" #include "trtmc/runtime/family_factory.h" #include "trtmc/runtime/trt_backend.h" #include #include extern "C" trtmc::ITask* trtmc_create_family(const trtmc::FamilyContext& context) { if (context.kv_cache_size_bytes != 0) throw std::invalid_argument("vivit does not support --kv-cache-size"); auto section = [&](const char* name) { const auto* found = context.reader.find_section(name); if (!found || found->length == 0) throw std::runtime_error(std::string("vivit missing section: ") + name); return context.reader.read_section(name); }; const auto data = section("runtime.json"); const auto config = nlohmann::json::parse(data.begin(),data.end()); if (config.at("schema_version").get() != 1 || config.at("frames").get() != 32 || config.at("image_size").get() != 224 || config.at("num_classes").get() != 400) throw std::invalid_argument("vivit unsupported runtime schema or geometry"); const auto plan = section("classifier.plan"); return new trtmc::vivit::Pipeline(context.backend.create_module(plan.data(), plan.size(), {}), 400); }