技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
timm【数据与研究】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.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.
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.
Run a no-download import check before deeper work:
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
Use scripts/timm_quick_check.py for a repeatable no-download smoke check covering model creation, data config, transform construction, optimizer, and scheduler setup.
Route to the focused sub-skill below before writing long code or commands.
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.references/repo-provenance.md to decide whether this skill matches the source checkout or should be refreshed.references/package-overview.md for package surfaces, install expectations, optional dependency boundaries, and high-level workflow map.references/troubleshooting.md for cross-cutting install/import, torch/torchvision, pretrained download, device/backend, and source-script issues.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.SKILL.md.pretrained=False for smoke checks; pretrained=True can download weights and may require Hugging Face Hub access or a configured cache.model.pretrained_cfg whenever pretrained weights are involved; wrong crop/resize/normalization can silently degrade predictions.model-library, then use benchmarking-and-results only if they need performance/result tradeoffs.model-library for the exact model/pretrained tag and data-pipelines for transform/crop/normalization alignment.cli-workflows; if they ask for optimizer/scheduler/loss code inside their own loop, use training-workflows.export-and-interoperability.layers-and-components.