Skip to content
8 changes: 8 additions & 0 deletions .claude/skills/mblt-vision/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ description: >-
Use file_cfg.filename for MXQ and derive the same-stem ONNX artifact unless
onnx_filename is required.
- Every post_cfg declares dataset; resolve output taxonomy from the dataset/task pair.
- Additional published EfficientViT/LeViT/ViT classifiers use `bases/imagenet_classifier.yaml`.
Preserve the recorded ops transforms checked by `tests/test_published_classifiers.py`,
including the TF-normalized `ViT_Large_Patch14_CLIP_224` exception. Their MXQ-only
repositories use `onnx_local_artifact_only: true`: require trusted local ONNX and
retain automatic MXQ loading; metadata validation skips only the marked framework.
- New pending family siblings use `file_cfg.artifact_status: pending_hf_family_sibling`
and require trusted local artifacts for runtime/compile. Report them as pending without
network; retain byte-identical existing sibling YAMLs.
- For Hub linkage changes, run `tests/test_hub_validation.py` as described in `tests/TEST.md`.
The metadata checker follows runtime board paths without downloading weights; live commits
are diagnostics, not substitutes for missing historical approval provenance.
Expand Down
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ The current ownership boundary is deliberate:
floors, and rounding differs by a pixel at 224/0.9 and 224/0.95. Several names
(ConvNext_Base) resolve in timm yet carry torchvision's transform here, so read the
expected value from that model's source.yaml provenance rather than from the name.
- Published EfficientViT, non-convolutional LeViT and additional ViT classifiers inherit
`bases/imagenet_classifier.yaml`. Their exact recorded preprocessing and dataset connection
are pinned by `tests/test_published_classifiers.py`; preserve TF normalization for
`ViT_Large_Patch14_CLIP_224` rather than inferring normalization from its name.
These 24 repositories are MXQ-only: their base uses `onnx_local_artifact_only: true`.
Keep automatic MXQ loading enabled, require trusted local ONNX, and test both guard paths.
Newly added EfficientViT B0/B1/B2 sibling configs carry
`artifact_status: pending_hf_family_sibling`: verify as pending without network and
require trusted local runtime/compile inputs. Existing sibling configs stay unchanged.
- To share processing defaults without changing legacy models, opt new family YAMLs into
`extends: bases/family.yaml#DEFAULT`. See the configuration-inheritance section of
`mblt_vision/README.md` for ordering and merge rules. Keep legacy `update` shallow and
Expand Down
35 changes: 35 additions & 0 deletions mblt_vision/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,41 @@ This section lists the publicly pre-trained models supported by the vision frame

### Image Classification

Additional published ImageNet classifiers are available through the same task
subpackage, top-level lazy exports and `MBLT_Engine`:

- EfficientViT: `EfficientViT_B3`, `EfficientViT_L1`, `EfficientViT_L2`, `EfficientViT_L3`.
- Non-convolutional LeViT: `LeViT_128`, `LeViT_128S`, `LeViT_192`, `LeViT_256`, `LeViT_384`.
- ViT RPN, relative-position, SRelPos, GAP and CLIP families: discover exact names with
`list_models("image_classification")`.

These configurations extend `models/bases/imagenet_classifier.yaml` and override
only recorded processing differences. The source is each model's
`models/image_classification/<Model>/_source/predict_float.input.json` and matching
`distribution.yaml` in mblt-model-ops at `6fdbf471a3bd6ec22035a42c8730fe88a68881e4`.
Input crop/resize and normalization are model-specific: in particular,
`ViT_Large_Patch14_CLIP_224` uses TF normalization despite its CLIP name.
All 24 additions retain the existing `revision: main` convention because their
historical approved artifact HF commits are not recorded; current Hub tips and
upstream source-model commits are not substituted as approval pins. This is a
configuration/CPU processing parity addition, not a new inference accuracy claim.
All 24 Hub repositories expose MXQ only, with no published ONNX file. Their base
sets `file_cfg.onnx_local_artifact_only: true`: MXQ Hub loading remains enabled,
but ONNX requires a trusted local `model_path` or `onnx_path`. Automatic ONNX
loading fails with a specific message, and metadata verification skips only that
framework. Existing configurations without this marker retain their behavior.

`EfficientViT_B0`, `EfficientViT_B1` and `EfficientViT_B2` are intentional family
sibling configurations using official timm 1.0.14 `r224_in1k` defaults (224 crop,
bicubic resize to `floor(224 / 0.95) = 235`, ImageNet normalization). They are
**pending HF (family sibling)**, not published-model claims. Their
`file_cfg.artifact_status: pending_hf_family_sibling` makes metadata verification
skip both frameworks without network access and allows runtime/compile use only
with trusted local artifacts. Existing sibling configurations are not rewritten.
EfficientViT M0–M5 is a distinct architecture and is not added here. Alternative
ViT CLIP/GAP resolutions require exact upstream squash-mode preprocessing support;
this change does not approximate them with center cropping.

| Model | Input Size<br>(H,W,C) | Acc<sup>Top1</sup><br>(NPU) | Acc<sup>Top1</sup><br>(GPU) | FLOPs (B) | params (M) | Source | Note |
| --- | --- | --- | --- | --- | --- | --- | --- |
| AlexNet | (224,224,3) | 56.084 | 56.556 | 1.43 | 61.10 | [Link](https://docs.pytorch.org/vision/stable/models/generated/torchvision.models.alexnet.html) | |
Expand Down
24 changes: 21 additions & 3 deletions mblt_vision/_hub_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,21 @@ def check_hub_artifacts(
paths.append(
(framework, f"{board}/{filename}" if framework == "mxq" else filename)
)
if files.get("local_artifact_only"):

if files.get("artifact_status") == "pending_hf_family_sibling":
return tuple(
HubArtifactCheck(
repo_id, revision, None, framework, path, "pending_hf_family_sibling"
)
for framework, path in paths
)

def is_local_only(framework: str) -> bool:
return bool(files.get("local_artifact_only")) or (
framework == "onnx" and bool(files.get("onnx_local_artifact_only"))
)

if all(is_local_only(framework) for framework, _ in paths):
return tuple(
HubArtifactCheck(
repo_id, revision, None, framework, path, "local_artifact_only"
Expand All @@ -91,10 +105,14 @@ def check_hub_artifacts(
HubArtifactCheck(
repo_id,
revision,
info.sha,
None if is_local_only(framework) else info.sha,
framework,
path,
"resolved" if path in available else "missing",
"local_artifact_only"
if is_local_only(framework)
else "resolved"
if path in available
else "missing",
)
for framework, path in paths
)
17 changes: 15 additions & 2 deletions mblt_vision/compile/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,10 @@ def resolve_quantization_values(
_validate_ratio("topk_ratio", topk_ratio) if topk_ratio is not None else None
)
hosted_config: dict[str, Any] | None = None
if (resolved_percentile is None or resolved_topk is None) and not file_cfg.get(
"local_artifact_only"
if (
(resolved_percentile is None or resolved_topk is None)
and not file_cfg.get("local_artifact_only")
and file_cfg.get("artifact_status") != "pending_hf_family_sibling"
):
repo_id = file_cfg.get("repo_id")
revision = file_cfg.get("revision", "main")
Expand Down Expand Up @@ -884,13 +886,24 @@ def _resolve_compile_onnx_path(
repo_id = file_cfg.get("repo_id")
revision = file_cfg.get("revision")
filename = _configured_onnx_filename(file_cfg)
if file_cfg.get("artifact_status") == "pending_hf_family_sibling":
raise RuntimeError(
"This configuration is pending HF (family sibling). Supply a trusted local "
"model_path or onnx_path for compilation; automatic downloads are disabled."
)
if file_cfg.get("local_artifact_only"):
repository = repo_id if isinstance(repo_id, str) and repo_id else "this model"
raise RuntimeError(
f"Remote artifacts for '{repository}' are disabled because this model does not "
"have a repository-pinned immutable revision and SHA-256 digest. Supply a "
"trusted local model_path or onnx_path instead."
)
if file_cfg.get("onnx_local_artifact_only"):
repository = repo_id if isinstance(repo_id, str) and repo_id else "this model"
raise RuntimeError(
f"'{repository}' publishes MXQ artifacts only. ONNX compilation requires a trusted "
"local model_path or onnx_path; automatic ONNX downloads are disabled."
)
if isinstance(repo_id, str) and isinstance(revision, str) and filename:
downloaded_path = Path(
hf_hub_download(
Expand Down
88 changes: 71 additions & 17 deletions mblt_vision/image_classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
from .._compat import create_model_class

__all__: list[str] = [
"VGG11",
"VGG11_BN",
"VGG13",
"VGG13_BN",
"VGG16",
"VGG16_BN",
"VGG19",
"VGG19_BN",
"AlexNet",
"CAFormer_B36",
"CAFormer_M36",
Expand All @@ -21,17 +29,17 @@
"ConvNeXt_Large",
"ConvNeXt_Small",
"ConvNeXt_Tiny",
"DeiT_Base_Patch16_224",
"DeiT_Base_Patch16_384",
"DeiT_Small_Patch16_224",
"DeiT_Tiny_Patch16_224",
"DeiT3_Base_Patch16_224",
"DeiT3_Base_Patch16_384",
"DeiT3_Large_Patch16_224",
"DeiT3_Large_Patch16_384",
"DeiT3_Medium_Patch16_224",
"DeiT3_Small_Patch16_224",
"DeiT3_Small_Patch16_384",
"DeiT_Base_Patch16_224",
"DeiT_Base_Patch16_384",
"DeiT_Small_Patch16_224",
"DeiT_Tiny_Patch16_224",
"DenseNet121",
"DenseNet161",
"DenseNet169",
Expand All @@ -50,11 +58,23 @@
"EfficientNet_V2_L",
"EfficientNet_V2_M",
"EfficientNet_V2_S",
"EfficientViT_B0",
"EfficientViT_B1",
"EfficientViT_B2",
"EfficientViT_B3",
"EfficientViT_L1",
"EfficientViT_L2",
"EfficientViT_L3",
"FlexiViT_Base",
"FlexiViT_Large",
"FlexiViT_Small",
"GoogLeNet",
"Inception_V3",
"LeViT_128",
"LeViT_128S",
"LeViT_192",
"LeViT_256",
"LeViT_384",
"LeViT_Conv_128",
"LeViT_Conv_128S",
"LeViT_Conv_192",
Expand Down Expand Up @@ -89,14 +109,14 @@
"RepViT_M2",
"RepViT_M2_3",
"RepViT_M3",
"ResNeXt50_32x4d",
"ResNeXt101_32x8d",
"ResNeXt101_64x4d",
"ResNet18",
"ResNet34",
"ResNet50",
"ResNet101",
"ResNet152",
"ResNeXt50_32x4d",
"ResNeXt101_32x8d",
"ResNeXt101_64x4d",
"ShuffleNet_V2_X0_5",
"ShuffleNet_V2_X1_0",
"ShuffleNet_V2_X1_5",
Expand All @@ -106,34 +126,41 @@
"Swin_B",
"Swin_S",
"Swin_T",
"VGG11",
"VGG11_BN",
"VGG13",
"VGG13_BN",
"VGG16",
"VGG16_BN",
"VGG19",
"VGG19_BN",
"VisFormer_Small",
"VisFormer_Tiny",
"ViT_B_16",
"ViT_B_32",
"ViT_Base_Patch8_224",
"ViT_Base_Patch16_224",
"ViT_Base_Patch16_384",
"ViT_Base_Patch16_CLIP_224",
"ViT_Base_Patch16_RPN_224",
"ViT_Base_Patch32_224",
"ViT_Base_Patch32_384",
"ViT_Base_Patch32_CLIP_224",
"ViT_Base_Patch32_CLIP_384",
"ViT_Base_Patch32_CLIP_448",
"ViT_Huge_Patch14_CLIP_224",
"ViT_L_16",
"ViT_L_32",
"ViT_Large_Patch14_CLIP_224",
"ViT_Large_Patch16_224",
"ViT_Large_Patch16_384",
"ViT_Large_Patch32_384",
"ViT_Medium_Patch16_GAP_256",
"ViT_RelPos_Base_Patch16_224",
"ViT_RelPos_Base_Patch32_Plus_RPN_256",
"ViT_RelPos_Medium_Patch16_224",
"ViT_RelPos_Medium_Patch16_RPN_224",
"ViT_RelPos_Small_Patch16_224",
"ViT_SRelPos_Medium_Patch16_224",
"ViT_SRelPos_Small_Patch16_224",
"ViT_Small_Patch16_224",
"ViT_Small_Patch16_384",
"ViT_Small_Patch32_224",
"ViT_Small_Patch32_384",
"ViT_Tiny_Patch16_224",
"ViT_Tiny_Patch16_384",
"VisFormer_Small",
"VisFormer_Tiny",
"Wide_ResNet50_2",
"Wide_ResNet101_2",
"YOLO11lCls",
Expand All @@ -158,6 +185,33 @@
"YOLOv8xCls",
]

EfficientViT_B0 = create_model_class("EfficientViT_B0", __name__)
EfficientViT_B1 = create_model_class("EfficientViT_B1", __name__)
EfficientViT_B2 = create_model_class("EfficientViT_B2", __name__)
EfficientViT_B3 = create_model_class("EfficientViT_B3", __name__)
EfficientViT_L1 = create_model_class("EfficientViT_L1", __name__)
EfficientViT_L2 = create_model_class("EfficientViT_L2", __name__)
EfficientViT_L3 = create_model_class("EfficientViT_L3", __name__)
LeViT_128 = create_model_class("LeViT_128", __name__)
LeViT_128S = create_model_class("LeViT_128S", __name__)
LeViT_192 = create_model_class("LeViT_192", __name__)
LeViT_256 = create_model_class("LeViT_256", __name__)
LeViT_384 = create_model_class("LeViT_384", __name__)
ViT_RelPos_Medium_Patch16_RPN_224 = create_model_class("ViT_RelPos_Medium_Patch16_RPN_224", __name__)
ViT_RelPos_Base_Patch32_Plus_RPN_256 = create_model_class("ViT_RelPos_Base_Patch32_Plus_RPN_256", __name__)
ViT_Base_Patch16_RPN_224 = create_model_class("ViT_Base_Patch16_RPN_224", __name__)
ViT_Base_Patch16_CLIP_224 = create_model_class("ViT_Base_Patch16_CLIP_224", __name__)
ViT_Base_Patch32_CLIP_448 = create_model_class("ViT_Base_Patch32_CLIP_448", __name__)
ViT_Medium_Patch16_GAP_256 = create_model_class("ViT_Medium_Patch16_GAP_256", __name__)
ViT_Large_Patch14_CLIP_224 = create_model_class("ViT_Large_Patch14_CLIP_224", __name__)
ViT_Base_Patch32_CLIP_224 = create_model_class("ViT_Base_Patch32_CLIP_224", __name__)
ViT_RelPos_Small_Patch16_224 = create_model_class("ViT_RelPos_Small_Patch16_224", __name__)
ViT_Base_Patch32_CLIP_384 = create_model_class("ViT_Base_Patch32_CLIP_384", __name__)
ViT_SRelPos_Medium_Patch16_224 = create_model_class("ViT_SRelPos_Medium_Patch16_224", __name__)
ViT_Huge_Patch14_CLIP_224 = create_model_class("ViT_Huge_Patch14_CLIP_224", __name__)
ViT_RelPos_Base_Patch16_224 = create_model_class("ViT_RelPos_Base_Patch16_224", __name__)
ViT_RelPos_Medium_Patch16_224 = create_model_class("ViT_RelPos_Medium_Patch16_224", __name__)
ViT_SRelPos_Small_Patch16_224 = create_model_class("ViT_SRelPos_Small_Patch16_224", __name__)
AlexNet = create_model_class("AlexNet", __name__)
CAFormer_B36 = create_model_class("CAFormer_B36", __name__)
CAFormer_M36 = create_model_class("CAFormer_M36", __name__)
Expand Down
13 changes: 13 additions & 0 deletions mblt_vision/models/EfficientViT_B0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Official timm 1.0.14 efficientvit_b0.r224_in1k pretrained_cfg:
# 224 crop, bicubic, crop_pct 0.95 -> floor(224 / 0.95) = 235, ImageNet torch stats.
# Family sibling configuration; no published artifact or approval is claimed.
DEFAULT:
extends: bases/imagenet_classifier.yaml
file_cfg:
repo_id: mobilint/EfficientViT_B0
filename: efficientvit_b0.mxq
revision: main
artifact_status: pending_hf_family_sibling
pre_cfg:
Resize:
size: 235
13 changes: 13 additions & 0 deletions mblt_vision/models/EfficientViT_B1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Official timm 1.0.14 efficientvit_b1.r224_in1k pretrained_cfg:
# 224 crop, bicubic, crop_pct 0.95 -> floor(224 / 0.95) = 235, ImageNet torch stats.
# Family sibling configuration; no published artifact or approval is claimed.
DEFAULT:
extends: bases/imagenet_classifier.yaml
file_cfg:
repo_id: mobilint/EfficientViT_B1
filename: efficientvit_b1.mxq
revision: main
artifact_status: pending_hf_family_sibling
pre_cfg:
Resize:
size: 235
13 changes: 13 additions & 0 deletions mblt_vision/models/EfficientViT_B2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Official timm 1.0.14 efficientvit_b2.r224_in1k pretrained_cfg:
# 224 crop, bicubic, crop_pct 0.95 -> floor(224 / 0.95) = 235, ImageNet torch stats.
# Family sibling configuration; no published artifact or approval is claimed.
DEFAULT:
extends: bases/imagenet_classifier.yaml
file_cfg:
repo_id: mobilint/EfficientViT_B2
filename: efficientvit_b2.mxq
revision: main
artifact_status: pending_hf_family_sibling
pre_cfg:
Resize:
size: 235
12 changes: 12 additions & 0 deletions mblt_vision/models/EfficientViT_B3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Approval HF commit: not recorded. Do not substitute upstream source-model commits.
# Preprocessing: mblt-model-ops models/image_classification/EfficientViT_B3/_source/predict_float.input.json
DEFAULT:
extends: bases/imagenet_classifier.yaml
file_cfg:
repo_id: mobilint/EfficientViT_B3
filename: efficientvit_b3.mxq
revision: main
Comment thread
parkjinman98 marked this conversation as resolved.
Resolved
pre_cfg:
Resize:
interpolation: bicubic
size: 235
8 changes: 8 additions & 0 deletions mblt_vision/models/EfficientViT_L1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Approval HF commit: not recorded. Do not substitute upstream source-model commits.
# Preprocessing: mblt-model-ops models/image_classification/EfficientViT_L1/_source/predict_float.input.json
DEFAULT:
extends: bases/imagenet_classifier.yaml
file_cfg:
repo_id: mobilint/EfficientViT_L1
filename: efficientvit_l1.mxq
revision: main
8 changes: 8 additions & 0 deletions mblt_vision/models/EfficientViT_L2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Approval HF commit: not recorded. Do not substitute upstream source-model commits.
# Preprocessing: mblt-model-ops models/image_classification/EfficientViT_L2/_source/predict_float.input.json
DEFAULT:
extends: bases/imagenet_classifier.yaml
file_cfg:
repo_id: mobilint/EfficientViT_L2
filename: efficientvit_l2.mxq
revision: main
8 changes: 8 additions & 0 deletions mblt_vision/models/EfficientViT_L3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Approval HF commit: not recorded. Do not substitute upstream source-model commits.
# Preprocessing: mblt-model-ops models/image_classification/EfficientViT_L3/_source/predict_float.input.json
DEFAULT:
extends: bases/imagenet_classifier.yaml
file_cfg:
repo_id: mobilint/EfficientViT_L3
filename: efficientvit_l3.mxq
revision: main
Loading
Loading