AGENT SKILL

composer

Use MosaicML Composer for PyTorch training loops, speedup methods, loggers, checkpoints, distributed launch, profiling, and model export.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
composer
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use MosaicML Composer for PyTorch training loops, speedup methods, loggers, checkpoints, distributed launch, profiling, and model export.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

MosaicML Composer Repo Skill

Use this repo skill when a task involves MosaicML Composer, the mosaicml Python distribution, or the importable composer package for PyTorch training engines, efficient training methods, callbacks/loggers, checkpoints, distributed launch, profiling, or model export.

Public install:

pip install mosaicml

Minimal import check:

python - <<'PY'
import composer
print(composer.__version__)
from composer import Trainer
print(Trainer)
PY

For optional integrations, read installation and package map before adding extras.

Route by task

  • Build, run, resume, or debug a training workflow: read training. This route owns Trainer, ComposerModel, ComposerClassifier, DataSpec, Evaluator, Time, State, manual checkpoint load, autoresume, and basic device/precision choices.
  • Add or debug Composer speedup methods: read methods. This route owns composer.algorithms, composer.functional, MixUp/CutMix/LabelSmoothing, model surgery, batch-key routing, and method recipe placement.
  • Make run state visible: read observability. This route owns loggers, monitoring callbacks, local/remote file upload, profiler traces, composer_collect_env, and observability troubleshooting.
  • Launch or reason about distributed/backend workflows: read distributed. This route owns the composer launcher, rank/world-size helpers, distributed samplers, get_device, FSDP/FSDP2/TP basics, and auto microbatching caveats.
  • Export models for inference: read inference-export. This route owns export_for_inference, ExportForInferenceCallback, TorchScript/ONNX validation, checkpoint-backed export, and optional HuggingFace/PEFT caveats.

Root references and scripts

  • Installation and package map: distribution/import names, optional extras, top-level namespaces, console entry points, and first checks.
  • Troubleshooting: cross-cutting install/import, backend, optional dependency, CLI, and package-surface failures.
  • Repo provenance: source commit, branch, package version, dirty-state baseline, and relative evidence paths.
  • Routing metadata: structured scenario placement for managed repo-skill import.
  • check_import.py: safe JSON import/backend probe for Composer and PyTorch.
  • run_smokes.py: runs bundled sub-skill smoke scripts with the current Python.

Fast operating workflow

  1. Verify installation with python scripts/check_import.py from this skill root.
  2. Pick the closest sub-skill route from the task wording and load only the references/scripts it names.
  3. Start with CPU/tiny-data scripts when debugging model, data, or API issues.
  4. Add optional extras only for the integration in use; do not install mosaicml[all] unless the task truly spans many optional backends.
  5. For GPU/distributed issues, run the distributed device_probe.py before launching training.
  6. For checkpoint/export issues, decide whether the task is about training-state resume or inference artifact export; route accordingly.
  7. Keep generated project code independent of this skill's source provenance and do not copy private machine paths into user scripts.

Composer concepts to recognize

  • Trainer is the high-level training loop that manages fit/eval/predict, checkpoint save/load, callbacks, algorithms, logging, precision, devices, and distributed integration.
  • ComposerModel is the model contract for batches; ComposerClassifier wraps simple (input, target) classification modules.
  • Algorithm classes integrate methods through Trainer events; composer.functional helpers are for custom loops or one-off model/batch mutation.
  • LoggerDestination subclasses receive metrics and uploaded files; callbacks and trace handlers generate many of those files.
  • The composer console entry point launches multi-process distributed jobs and configures rank environment variables.
  • export_for_inference and ExportForInferenceCallback produce TorchScript or ONNX artifacts after optional load/surgery/transform steps.

Avoid using this skill when

  • The task is ordinary PyTorch with no Composer APIs, errors, configs, or artifacts.
  • The user is actually using PyTorch Lightning, Accelerate, DeepSpeed, or another training framework without Composer.
  • The task is model-family-specific and only incidentally mentions a project that once used Composer.
  • The user asks to edit the Composer repository itself rather than operate the package; this skill is for package/runtime use, not maintainer development.

Verification posture

The generated skill favors CPU-safe, no-download workflows first and documents CUDA/distributed behavior with backend caveats. Optional CUDA was available during construction and a PyTorch CUDA smoke passed, but production-scale multi-rank training should still be verified in the user's target environment before relying on it.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351