mmpretrain
Operate MMPreTrain model-zoo inference, config-driven training and evaluation, dataset/customization, analysis utilities, checkpoint conversion, and serving workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- mmpretrain
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate MMPreTrain model-zoo inference, config-driven training and evaluation, dataset/customization, analysis utilities, checkpoint conversion, and serving workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/installation-and-troubleshooting.md4.3 KB
- 参考文档references/package-overview.md3.1 KB
- 参考文档references/repo-provenance.md1.8 KB
- 参考文档references/repo-routing-metadata.json510 B
- 脚本scripts/check_mmpretrain_env.py5.1 KB
03 SKILL.md 正文
MMPreTrain repo skill
Use this skill when a task involves MMPreTrain / OpenMMLab Model Pretraining Toolbox as a package or framework: model-zoo discovery, inference, feature extraction, config-driven training/testing, dataset preparation, registry customization, analysis tools, checkpoint conversion, or serving packaging.
First checks
- Read
references/package-overview.mdfor the package surfaces and optional capability map. - Read
references/installation-and-troubleshooting.mdwhen installation, import, ModelHub, optional dependencies, or backend readiness are uncertain. - Run
scripts/check_mmpretrain_env.pyfor a no-download package smoke check before relying on model-zoo APIs or backend-specific behavior. - Read
references/repo-provenance.mdbefore deciding whether this skill is stale for a different checkout or package version.
Route by task
| User task | Read |
|---|---|
List available models, choose a checkpoint policy, use get_model, run image classification, retrieval, captioning, VQA, visual grounding, NLVR, or extract features |
sub-skills/model-zoo-inference/SKILL.md |
Inspect or modify configs, plan mim train mmpretrain / mim test mmpretrain, choose CPU/GPU/distributed/Slurm launch, use resume/AMP/auto-scale-lr/TTA/output dumps, or plan K-fold |
sub-skills/training-and-evaluation/SKILL.md |
Prepare CustomDataset, ImageNet, or OpenMMLab 2.0 annotations; inspect dataloader fields; build transform pipelines; register custom datasets/models/metrics/hooks/optimizers |
sub-skills/datasets-and-customization/SKILL.md |
| Analyze JSON logs/results, compute metrics/confusion matrices/FLOPs, visualize CAM/t-SNE/schedulers/datasets, publish/convert checkpoints, reparameterize, or package TorchServe artifacts | sub-skills/tools-analysis-and-deployment/SKILL.md |
Install baseline
Typical package install:
pip install -U openmim
mim install "mmpretrain>=1.0.0rc8"
Development/package-tool install:
pip install -U openmim
mim install -e .
Multi-modal workflows need the optional dependency group:
mim install "mmpretrain[multimodal]>=1.0.0rc8"
MMPreTrain expects Python 3.7+, PyTorch 1.8+, mmcv>=2.0.0,<2.4.0, and mmengine>=0.8.3,<1.0.0. Select a CUDA-capable PyTorch/MMCV build only when the task requires GPU or distributed behavior.
Safe operating defaults
- For offline or architecture-only model work, use
get_model(..., pretrained=False)or inferencerpretrained=False; inferencer classes otherwise try default weights. - For CPU-only train/test planning, use MIM package commands with
--gpus 0and/orCUDA_VISIBLE_DEVICES=-1. - Inspect a merged config and dataset fields before long runs; route config work to
training-and-evaluationand dataset schema work todatasets-and-customization. - Treat checkpoint downloads, dataset downloads, TorchServe startup, Slurm jobs, and GPU training as resource-requiring actions. Confirm resources before launching them.
- Use bundled helpers and references here; do not depend on the original repository checkout being present.
Common failure routing
File ... .mim/model-index.yml does not exist, incompatiblemmcv/mmengine, NumPy ABI warnings, or CUDA backend mismatch:references/installation-and-troubleshooting.md.- Invalid model name, checkpoint download/cache error, device mismatch, or missing multimodal extras during inference:
sub-skills/model-zoo-inference/references/troubleshooting.md. - Bad
_base_inheritance,--cfg-optionsquoting,load_fromversusresume, AMP/TTA, or distributed launch hangs:sub-skills/training-and-evaluation/references/troubleshooting.md. - Bad annotation paths/labels, missing
LoadImageFromFile, unreadable images, or registryKeyError:sub-skills/datasets-and-customization/references/troubleshooting.md. - Plotting/headless errors, optional Grad-CAM/t-SNE deps, checkpoint format mismatch, EMA publishing, or TorchServe service errors:
sub-skills/tools-analysis-and-deployment/references/troubleshooting.md.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).