Skip to content

refactor(cli): localize ten timm vision CLIs - #1374

Open
yifeif-nv wants to merge 1 commit into
NVIDIA:mainfrom
yifeif-nv:agent/family-cli-batch-1
Open

yifeif-nv wants to merge 1 commit into
NVIDIA:mainfrom
yifeif-nv:agent/family-cli-batch-1

Conversation

@yifeif-nv

@yifeif-nv yifeif-nv commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Background

Follow up #1310 by moving ten existing families' CLI definitions and execution into their owning directories. New options can then be added without changing the public parser or shared build request.

Exit Criteria

  • Each family owns its build declaration, typed request, native handler and tests.
  • Existing defaults, supported inputs, legacy rejection behavior and numerical criteria are preserved.
  • Discovery, help, runtime staging and packaging use the existing generic protocol.

Implementation

Families: timm_convnext, timm_crossvit, timm_densenet, timm_dpn, timm_efficientnet, timm_ghostnet, timm_hrnet, timm_inception, timm_inception_resnet, timm_inception_v4.

Adds build and classify, lazy Python build handlers and native adapter targets. Existing family runtime interfaces are reused inside owner handlers. Model graphs and build policies remain in their existing owners. Existing flat CLI entry points remain compatible; public Task ABI, bundle format and dependencies are unchanged.

Change categories

  • Model or runtime behavior
  • Public API
  • ABI
  • Bundle or artifact format
  • Dependencies
  • Documentation only
  • CI or developer tooling

Validation

Commands and Results

  • Remote CI on 5f2956172db402f1a71db12759dfd1dca1e6b06a: Stable Community CI — passed; Dev Community CI — passed; TRTMC Internal CI / Automated premerge gate — passed.

  • CI_BASE_REF=4b9cc2b0f259e8959e1a5c0e996506e60d7101b5 python3 -m tools.ci pipeline source-quality: passed, including 296 architecture and CI contract tests.

  • Owner CPU suite: 415 passed / 11 existing selector skips:

python3 -m pytest families/timm_convnext/tests families/timm_crossvit/tests families/timm_densenet/tests families/timm_dpn/tests families/timm_efficientnet/tests families/timm_ghostnet/tests families/timm_hrnet/tests families/timm_inception/tests families/timm_inception_resnet/tests families/timm_inception_v4/tests -m "not gpu and not trt" -q -p no:cacheprovider
  • cmake --build /work/build --parallel 8 and ctest --test-dir /work/build --output-on-failure --label-exclude gpu: a local integration tree containing all five independent migration batches passed 268 tests / 7 expected no-device skips, including this batch's 10 native CLI handler tests.
  • python3 -m build --no-isolation --wheel --outdir /work/wheels -Cbuild-dir=/work/wheel-build .: the same integration tree built a real wheel; archive/installed validators passed for all 128 model families. Installed-only probes passed owner build dispatch for all 50 migrated families, 120 offline help commands and 70 native adapter family guards.
  • Model math/build-policy definitions and existing E2E assertions were compared with the baseline. The tests now call the owner entry points with the same acceptance criteria.

Hardware, Environment, and Revisions

Head: 5f2956172db402f1a71db12759dfd1dca1e6b06a. Base: 4b9cc2b0f259e8959e1a5c0e996506e60d7101b5. Local Linux/aarch64 CPU-only validation used TensorRT 11.1.0.106 and Torch 2.12.0+cu130. Synthetic runtime fixtures and probe bundles were used for CLI integration; the skipped tests retain their existing explicit GPU/E2E selectors.

Not Run / Remaining Gaps

Fresh checkpoint GPU inference, numerical/performance qualification and TensorRT-RTX execution were not run locally. The remote premerge result above covers the configured CI checks for this exact head; it does not establish coverage beyond those checks.

Contributor Self-Review

  • I have completed a self-review of this change.

Reviewed family ownership, supported parameters/defaults, old Python-call compatibility, native input/output contracts and failure behavior. Publication is gated on an independent review of outgoing code, commit metadata, PR text and CI output paths.

Notes For Future Readers

This is batch 1 of five independent ten-family migrations on the same base; no batch depends on another. Review cli.json, cli.py, native cli.cpp, then owner tests. Remaining families can follow the same pattern. Remove the shared legacy CLI/request only after migration is complete.

Risk level

  • Low
  • Medium
  • High

Ten families gain a new command path and adapter artifacts. Explicit defaults, strict rejection, owner tests and installed-package checks cover the integration boundary; they do not replace model qualification.

Add family-owned build and classify commands for ConvNeXt, CrossViT,
DenseNet, DPN, EfficientNet, GhostNet, HRNet, Inception, Inception-ResNet,
and Inception-v4. Keep existing Task SDK or legacy native interfaces and
preserve old request rejection rules through owner-local conversions.

Move owner E2E invocations to the new command prefixes without changing
model math or their assertions. Add CPU coverage for declaration/manifest
consumers, bundle publication and native callback execution.

Validation: 415 owner CPU tests passed, 11 skipped; 53 architecture checks
passed. Ruff, changed-function CCN <= 10, clang-format and diff checks pass.
GPU checkpoint validation was not run locally.

Signed-off-by: yifeif <277870278+yifeif-nv@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/TensorRT-Model-Connect/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7d1138c0-953f-4bbb-a92b-08e1acc37460

📥 Commits

Reviewing files that changed from the base of the PR and between 4b9cc2b and 5f29561.

📒 Files selected for processing (95)
  • families/timm_convnext/README.md
  • families/timm_convnext/cli.json
  • families/timm_convnext/cli.py
  • families/timm_convnext/model.py
  • families/timm_convnext/runtime/CMakeLists.txt
  • families/timm_convnext/runtime/cli.cpp
  • families/timm_convnext/tests/cpp/test_cli.cpp
  • families/timm_convnext/tests/manifests/convnext-tiny-in12k-ft-in1k.json
  • families/timm_convnext/tests/test_cli.py
  • families/timm_convnext/tests/test_e2e.py
  • families/timm_crossvit/cli.json
  • families/timm_crossvit/cli.py
  • families/timm_crossvit/model.py
  • families/timm_crossvit/runtime/CMakeLists.txt
  • families/timm_crossvit/runtime/cli.cpp
  • families/timm_crossvit/tests/cpp/test_cli.cpp
  • families/timm_crossvit/tests/manifests/crossvit-9-240-in1k.json
  • families/timm_crossvit/tests/test_cli.py
  • families/timm_crossvit/tests/test_e2e.py
  • families/timm_densenet/README.md
  • families/timm_densenet/cli.json
  • families/timm_densenet/cli.py
  • families/timm_densenet/model.py
  • families/timm_densenet/runtime/CMakeLists.txt
  • families/timm_densenet/runtime/cli.cpp
  • families/timm_densenet/tests/cpp/test_cli.cpp
  • families/timm_densenet/tests/manifests/densenet121-ra-in1k.json
  • families/timm_densenet/tests/test_cli.py
  • families/timm_densenet/tests/test_e2e.py
  • families/timm_dpn/cli.json
  • families/timm_dpn/cli.py
  • families/timm_dpn/model.py
  • families/timm_dpn/runtime/CMakeLists.txt
  • families/timm_dpn/runtime/cli.cpp
  • families/timm_dpn/tests/cpp/test_cli.cpp
  • families/timm_dpn/tests/manifests/dpn68b-ra-in1k.json
  • families/timm_dpn/tests/manifests/dpn92-mx-in1k.json
  • families/timm_dpn/tests/test_cli.py
  • families/timm_dpn/tests/test_e2e.py
  • families/timm_efficientnet/README.md
  • families/timm_efficientnet/cli.json
  • families/timm_efficientnet/cli.py
  • families/timm_efficientnet/model.py
  • families/timm_efficientnet/runtime/CMakeLists.txt
  • families/timm_efficientnet/runtime/cli.cpp
  • families/timm_efficientnet/tests/cpp/test_cli.cpp
  • families/timm_efficientnet/tests/manifests/efficientnet-b0-ra-in1k.json
  • families/timm_efficientnet/tests/test_cli.py
  • families/timm_efficientnet/tests/test_e2e.py
  • families/timm_ghostnet/README.md
  • families/timm_ghostnet/cli.json
  • families/timm_ghostnet/cli.py
  • families/timm_ghostnet/model.py
  • families/timm_ghostnet/runtime/CMakeLists.txt
  • families/timm_ghostnet/runtime/cli.cpp
  • families/timm_ghostnet/tests/cpp/test_cli.cpp
  • families/timm_ghostnet/tests/manifests/ghostnet-100-in1k.json
  • families/timm_ghostnet/tests/test_cli.py
  • families/timm_ghostnet/tests/test_e2e.py
  • families/timm_hrnet/cli.json
  • families/timm_hrnet/cli.py
  • families/timm_hrnet/model.py
  • families/timm_hrnet/runtime/CMakeLists.txt
  • families/timm_hrnet/runtime/cli.cpp
  • families/timm_hrnet/tests/cpp/test_cli.cpp
  • families/timm_hrnet/tests/manifests/hrnet-w18-ms-aug-in1k.json
  • families/timm_hrnet/tests/test_cli.py
  • families/timm_hrnet/tests/test_e2e.py
  • families/timm_inception/cli.json
  • families/timm_inception/cli.py
  • families/timm_inception/model.py
  • families/timm_inception/runtime/CMakeLists.txt
  • families/timm_inception/runtime/cli.cpp
  • families/timm_inception/tests/cpp/test_cli.cpp
  • families/timm_inception/tests/manifests/inception-v3-tv-in1k.json
  • families/timm_inception/tests/test_cli.py
  • families/timm_inception/tests/test_e2e.py
  • families/timm_inception_resnet/cli.json
  • families/timm_inception_resnet/cli.py
  • families/timm_inception_resnet/model.py
  • families/timm_inception_resnet/runtime/CMakeLists.txt
  • families/timm_inception_resnet/runtime/cli.cpp
  • families/timm_inception_resnet/tests/cpp/test_cli.cpp
  • families/timm_inception_resnet/tests/manifests/inception-resnet-v2-tf-in1k.json
  • families/timm_inception_resnet/tests/test_cli.py
  • families/timm_inception_resnet/tests/test_e2e.py
  • families/timm_inception_v4/cli.json
  • families/timm_inception_v4/cli.py
  • families/timm_inception_v4/model.py
  • families/timm_inception_v4/runtime/CMakeLists.txt
  • families/timm_inception_v4/runtime/cli.cpp
  • families/timm_inception_v4/tests/cpp/test_cli.cpp
  • families/timm_inception_v4/tests/manifests/inception-v4-tf-in1k.json
  • families/timm_inception_v4/tests/test_cli.py
  • families/timm_inception_v4/tests/test_e2e.py

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Summary

Summary

Refactors ten timm vision families to own their CLI definitions, typed build requests, lazy build handlers, native classification adapters, and tests.

The change preserves existing defaults, supported inputs, rejection behavior, model graphs, build policies, runtime interfaces, flat CLI compatibility, Task ABI, bundle format, and dependencies. E2E tests now use family-specific command prefixes and build APIs.

Architecture impact

  • Family-owned files: Each family now owns cli.json, cli.py, native runtime adapter code, CMake targets, CLI tests, and updated E2E coverage.
  • Shared surfaces: The change uses existing runtime, bundle, graph transformation, model resolution, and CLI callback contracts. No shared implementation change is shown in the supplied evidence.
  • Dependency direction: Family CLI modules depend on shared build infrastructure. Native adapters depend on existing runtime and JSON components. Model modules depend on their local CLI module for request normalization.
  • Affected consumers: Family CLI users, E2E tests, native dispatch, bundle builders, and installed runtime packages.
  • Unresolved blast radius: GPU inference, numerical and performance qualification, and TensorRT-RTX execution were not run locally.

Validation

Reported validation includes 296 architecture and CI contract tests, 415 owner CPU tests with 11 existing selector skips, native CLI handler tests, wheel and installed-package validation, and owner dispatch, help, and adapter probes.

Review finding counts are unavailable from the supplied evidence.

Outcome: HUMAN REVIEW REQUIRED

Walkthrough

Added family-owned build and classify CLI support for ten Timm model families. The changes add validated build flows, native classification adapters, CMake integration, contract tests, E2E wiring, manifest updates, and family-qualified documentation.

Changes

Timm family CLI support

Layer / File(s) Summary
Family build contracts and orchestration
families/timm_*/cli.json, families/timm_*/cli.py, families/timm_*/model.py
Each family now validates build requests, converts legacy requests, selects a backend, writes bundles, and exposes a family-owned build entry point.
Native classification adapters
families/timm_*/runtime/*
Each family now decodes RGB images, validates bundles, runs classification, serializes results, and reports handler or runtime errors through a C ABI.
CLI contract and build tests
families/timm_*/tests/test_cli.py, families/timm_*/tests/cpp/test_cli.cpp
Tests cover request validation, lazy loading, atomic bundle publication, runtime options, classification output, and failure paths.
E2E wiring, manifests, and documentation
families/timm_*/tests/test_e2e.py, families/timm_*/tests/manifests/*, families/timm_*/README.md
E2E tests use family-owned builders and native adapters. Manifests remove max_sequence_length. Documentation uses family-qualified commands.

Priority: ➖ Normal

Estimated code review effort: 5 (Critical) | ~90 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 5f295

No actionable merge-blocking risk remains in the supplied evidence.

🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 272 functions across 50 files. (45 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Family Ownership Boundary ✅ Passed No cross-family ownership dependency was introduced. The authoritative diff contains only files under the ten owning families/timm_* directories and no central registry or source-list changes. Each …
Shared Semantic Neutrality ✅ Passed PASS: The reviewed range changes only files under the ten owning families/timm_* directories. The inventory contains no shared-path changes outside the model-owned Python, runtime, C++ test, E2E, an…
Benchmark Validation Integrity ✅ Passed No benchmark measurement contract changes are introduced. The diff changes only the ten family owner CLI/build/runtime/test paths; no performance, benchmark reference, timing, metric, or report files …
Shared Change Blast Radius ✅ Passed The check is not triggered by a shared-surface change. The authoritative diff contains 95 files, all under the ten owning families/timm_* directories; no shared, tooling, catalog, example, benchmark…
Title check ✅ Passed The title clearly summarizes the main change: moving ten timm vision CLIs into their owning families.
Description check ✅ Passed The description covers the required template sections, including the motivation, exit criteria, implementation, change categories, validation evidence, environment, remaining gaps, self-review, and ri…
Full details: Docstring Coverage

Explanation

Docstring coverage is 9.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 272 functions across 50 files. (45 skipped: 35 unsupported, 10 over the file limit.)


Comment @coderabbitai help to get the list of available commands.

@yifeif-nv
yifeif-nv marked this pull request as ready for review September 22, 2026 21:23
@yifeif-nv yifeif-nv added the run-internal-ci Maintainer-approved dispatch to internal CI label Sep 22, 2026
@github-actions github-actions Bot removed the run-internal-ci Maintainer-approved dispatch to internal CI label Sep 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant