AGENT SKILL

ms-swift

Use ms-swift for LLM and multimodal training, inference, deployment, data/model customization, export, evaluation, RLHF, Ray, and Megatron workflows.

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

01 前言 Front Matter

name
ms-swift
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use ms-swift for LLM and multimodal training, inference, deployment, data/model customization, export, evaluation, RLHF, Ray, and Megatron workflows.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

ms-swift

Use this repo skill when a task mentions ms-swift, swift, ModelScope SWIFT, swift sft, swift infer, swift deploy, swift eval, swift export, swift rlhf, GRPO, Ray, or Megatron-SWIFT.

ms-swift is a Python framework for large-model and multimodal fine-tuning, inference, evaluation, quantization, deployment, RLHF/GRPO, Ray scheduling, and Megatron-style distributed training.

First Checks

  • Public package: install with pip install ms-swift -U; from source use pip install -e ..
  • Import check: python -c "import swift; print(swift.__version__)".
  • CLI check: swift sft --help, swift infer --help, swift export --help, and swift rlhf --help should work in a base install.
  • Optional extras are workflow-specific: evaluation needs EvalScope, advanced Megatron needs Megatron packages, and accelerated serving needs vLLM/SGLang/LMDeploy as appropriate.
  • Use local model and dataset paths plus offline flags when users cannot download from ModelScope or HuggingFace.

Route by User Goal

  • Train or fine-tune models: read sub-skills/training/SKILL.md for swift pt, swift sft, LoRA/QLoRA/full tuning, multimodal training, checkpoints, YAML/JSON configs, and training-time evaluation flags.
  • Infer, serve, or call a local model: read sub-skills/inference-deployment/SKILL.md for swift infer, swift app, swift deploy, backend selection, OpenAI-compatible APIs, adapters, batch inference, logprobs, and multimodal requests.
  • Prepare data or register models/templates: read sub-skills/data-model-customization/SKILL.md for dataset formats, --columns, --custom_dataset_info, --external_plugins, registry inspection, custom models, and templates.
  • Export, quantize, push, or evaluate: read sub-skills/export-evaluation/SKILL.md for swift export, swift merge-lora, quantization, hub pushes, swift eval, EvalScope backends, and custom eval datasets.
  • Use RLHF, GRPO, Ray, or Megatron: read sub-skills/advanced-rl-distributed/SKILL.md for swift rlhf, swift sample, swift rollout, reward plugins, Ray configs, Megatron-SWIFT, and distributed troubleshooting.

Shared References and Scripts

  • Read references/package-overview.md for package purpose, CLI route map, optional extras, and cross-skill terminology.
  • Read references/troubleshooting.md for install/import, optional dependency, backend, hub/offline, CLI/config, and hardware issues that cut across workflows.
  • Read references/repo-provenance.md when checking whether this skill is stale against a newer ms-swift checkout.
  • Run scripts/check_ms_swift_install.py --help for a safe installed-package and optional-dependency checker.
  • Run scripts/inspect_swift_cli.py --help for a safe CLI route inventory and help-command planner.

Common Decision Points

  • Use --model for full checkpoints or model IDs; use --adapters for LoRA adapter checkpoints.
  • If a LoRA checkpoint must run on vLLM/SGLang/LMDeploy as a merged full model, route through export/merge guidance first; do not promise QLoRA merge support.
  • If a task asks for dataset rows, schemas, media fields, or loss_scale, solve that in data/model customization before constructing training or RLHF commands.
  • If a task asks for deployment performance, distinguish model support from package availability: base ms-swift may install while vLLM, SGLang, LMDeploy, EvalScope, Ray, or Megatron extras remain absent.
  • If a task asks for GRPO or custom rewards, confirm the dataset fields and reward function signature before planning rollout placement or Ray/Megatron parallelism.

Runtime Safety

  • The bundled scripts print diagnostics or command skeletons; they do not launch training, download models, start servers, or push to hubs unless their help explicitly says otherwise.
  • Treat model downloads, hub pushes, long training, evaluation benchmarks, Ray/Megatron clusters, and accelerated serving as user-controlled side effects.
  • Keep credentials in environment variables such as MODELSCOPE_TOKEN, HF_TOKEN, or a user-provided shell environment; do not write tokens into command builders or config examples.

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