Skip to content
Back to skills

Model Inference

ASecurity

"Select, prepare, and run verified Gluon or PyTorch/pytorchcv

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 8, 2026
datapythonbashapi

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill model-inference --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Model Inference?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Model Inference
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-model-inference-ee18454f/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-model-inference-ee18454f)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: model-inference
description: "Select, prepare, and run verified Gluon or PyTorch/pytorchcv
  image-classification models with safe CPU defaults, strict local checkpoints,
  ImageNet preprocessing, and output checks."
disable-model-invocation: true
metadata:
  disco-role: operating
license: MIT
---

# Model inference

Use this skill for one-batch image-classification inference, model selection,
local checkpoint loading, input preprocessing, or lightweight model statistics
through the Gluon or PyTorch/pytorchcv providers.

## Safe default

Start from the sub-skill directory with a non-pretrained `resnet18` CPU smoke:

```bash
python scripts/infer_gluon.py --model resnet18
python scripts/infer_pytorch.py --model resnet18
```

Both scripts construct random weights by passing `pretrained=False`, use one
normalized `(1, 3, 224, 224)` input, and print the output shape, parameter count,
and zero-based top-k class indices/probabilities. If `--image` is omitted, the
input is a zero-valued RGB image before normalization, so the result is only a
shape/device smoke and has no accuracy meaning.

The scripts never request or download pretrained weights. A checkpoint is
accepted only as an existing local file; use `--checkpoint FILE` with the same
provider, model, class count, and input-channel count used to create it. The
PyTorch script also accepts `--remove-module` for a checkpoint saved under
`torch.nn.DataParallel`.

## Route by intent

1. Select a provider-supported model name. The providers lowercase the name
   and raise `ValueError` for an unsupported model; they do not infer aliases.
2. Keep `pretrained=False` for smoke tests. If using `--checkpoint`, keep the
   model and `--classes` aligned with the checkpoint and let strict loading
   expose missing, extra, or shape-incompatible parameters.
3. Apply the ImageNet RGB preprocessing in
   [checkpoints-and-inputs.md](references/checkpoints-and-inputs.md).
4. Assert that the input is NCHW and the output is rank-2 with batch size one
   before interpreting top-k results.
5. Use [api-reference.md](references/api-reference.md) for provider and local
   loading contracts. Use [troubleshooting.md](references/troubleshooting.md)
   for recovery.

Do not turn this route into training, resume, or dataset evaluation. Send
those requests to [training-evaluation](../training-evaluation/SKILL.md). Send
cross-framework parameter conversion to [conversion](../conversion/SKILL.md).
Send TensorFlow, Keras, and Chainer requests to
[framework-compatibility](../framework-compatibility/SKILL.md).

Files in this skill

  • SKILL.md2.5 KB
  • references/api-reference.md4 KB
  • references/checkpoints-and-inputs.md3.7 KB
  • references/troubleshooting.md4.3 KB
  • scripts/infer_gluon.py5.5 KB
  • scripts/infer_pytorch.py6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.