Skip to content
Back to skills

Timm

ASecurity

"Use PyTorch Image Models (timm) for model discovery, pretrained

  • 247 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 9, 2026
developmentpythonbashdebuggingapibackendperformance

Works with

  • cli
  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

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

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Timm?

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

Security grade badge for Timm
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-timm/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-timm)

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: timm
description: "Use PyTorch Image Models (timm) for model discovery, pretrained
  loading, transforms/data loaders, training APIs, repository CLI workflows,
  export/checkpoint interoperability, benchmarking/results, and reusable
  layers/components."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# PyTorch Image Models (timm)

Use this skill when a task involves the `timm` Python package or the PyTorch Image Models repository: creating vision models, loading pretrained weights, preparing transforms, training or evaluating image classifiers, exporting/checkpointing models, benchmarking model variants, or using timm layers in custom PyTorch code.

## Start Here

1. Install or verify the public package: `python -m pip install timm` for normal use, or `python -m pip install -e .` when working inside a timm checkout.
2. Run a no-download import check before deeper work:

   ```bash
   python - <<'PY'
   import timm, torch
   model = timm.create_model('resnet18', pretrained=False, num_classes=3)
   output = model(torch.randn(1, 3, 224, 224))
   print(timm.__version__, tuple(output.shape))
   PY
   ```

3. Use `scripts/timm_quick_check.py` for a repeatable no-download smoke check covering model creation, data config, transform construction, optimizer, and scheduler setup.
4. Route to the focused sub-skill below before writing long code or commands.

## Route By Task

- `sub-skills/model-library/`: model discovery, `create_model`, pretrained tags/configs, local checkpoints, classifier/input-channel changes, feature extraction, and model creation troubleshooting.
- `sub-skills/data-pipelines/`: `resolve_data_config`, `create_transform`, `create_dataset`, `create_loader`, ImageNet metadata, augmentation, prefetcher/device choices, and NaFlex data settings.
- `sub-skills/training-workflows/`: optimizer/scheduler/loss APIs, EMA, metrics, task and distillation wrappers, hparam interpretation, and API-level training smoke checks.
- `sub-skills/cli-workflows/`: dry construction of `train.py`, `validate.py`, `inference.py`, and distributed commands for users working with repository scripts or adapted copies.
- `sub-skills/export-and-interoperability/`: ONNX export/validation commands, checkpoint cleanup/averaging, Hugging Face Hub and `local-dir:` loading, Torch Hub notes, and conversion caveats.
- `sub-skills/benchmarking-and-results/`: bounded benchmark command construction, result CSV interpretation, model metadata lookup, and performance-comparison caveats.
- `sub-skills/layers-and-components/`: reusable timm layers, classifier heads, pooling, patch embedding, feature wrappers, custom components, and shape validation.

## Shared References

- Read `references/repo-provenance.md` to decide whether this skill matches the source checkout or should be refreshed.
- Read `references/package-overview.md` for package surfaces, install expectations, optional dependency boundaries, and high-level workflow map.
- Read `references/troubleshooting.md` for cross-cutting install/import, torch/torchvision, pretrained download, device/backend, and source-script issues.

## Shared Scripts

- Run `python scripts/timm_quick_check.py --model resnet18 --num-classes 3` to verify the current Python can import timm, create a model, run a small forward pass, resolve preprocessing config, and instantiate optimizer/scheduler objects without pretrained downloads.
- Use sub-skill scripts for focused command generation or component probes; they are linked from the nearest sub-skill `SKILL.md`.

## Safety And Scope

- Prefer `pretrained=False` for smoke checks; `pretrained=True` can download weights and may require Hugging Face Hub access or a configured cache.
- The repository root scripts are not normal pip console entry points. Use the CLI sub-skill to build commands only when the user has a timm checkout, a copied script, or an equivalent script path.
- Do not benchmark broad model lists by default. Bound model lists, batch sizes, warmup/iteration counts, devices, and precision choices before running expensive commands.
- For CPU-only environments, pass explicit CPU devices in loaders and scripts; several training/eval defaults target CUDA for performance.
- Keep model transforms tied to `model.pretrained_cfg` whenever pretrained weights are involved; wrong crop/resize/normalization can silently degrade predictions.

## Common First Decisions

- If the user asks “which model should I use?”, start in `model-library`, then use `benchmarking-and-results` only if they need performance/result tradeoffs.
- If the user asks “why are predictions wrong?”, check `model-library` for the exact model/pretrained tag and `data-pipelines` for transform/crop/normalization alignment.
- If the user asks for a training command, use `cli-workflows`; if they ask for optimizer/scheduler/loss code inside their own loop, use `training-workflows`.
- If the user asks for ONNX, safetensors, checkpoint cleanup, or Hub packaging, use `export-and-interoperability`.
- If the user is building custom architectures or debugging tensor shapes inside blocks, use `layers-and-components`.

Files in this skill

  • SKILL.md5.1 KB
  • references/package-overview.md3 KB
  • references/repo-provenance.md1.7 KB
  • references/repo-routing-metadata.json502 B
  • references/troubleshooting.md2.9 KB
  • scripts/timm_quick_check.py2.5 KB
  • sub-skills/benchmarking-and-results/SKILL.md2.6 KB
  • sub-skills/benchmarking-and-results/references/benchmarking.md6 KB
  • sub-skills/benchmarking-and-results/references/results-tables.md4.5 KB
  • sub-skills/benchmarking-and-results/references/troubleshooting.md4 KB
  • sub-skills/benchmarking-and-results/scripts/timm_benchmark_command_builder.py6.6 KB
  • sub-skills/cli-workflows/SKILL.md2.8 KB
  • sub-skills/cli-workflows/references/distributed-training.md3.9 KB
  • sub-skills/cli-workflows/references/train-validate-inference.md8.5 KB
  • sub-skills/cli-workflows/references/troubleshooting.md5.8 KB
  • sub-skills/cli-workflows/scripts/timm_cli_command_builder.py6.6 KB
  • sub-skills/data-pipelines/SKILL.md3.9 KB
  • sub-skills/data-pipelines/references/data-api.md6.6 KB
  • sub-skills/data-pipelines/references/transform-loader-recipes.md6.5 KB
  • sub-skills/data-pipelines/references/troubleshooting.md6.7 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.