agentleFS
hyf020908hyf020908/modelscope-skills/skills/modelscope-model-trainer/SKILL.md

modelscope-model-trainer

Skill4 starsChanged 8 months agoApache-2.0View on GitHub

Turn plain-language language-model training requests into ms-swift configs, PAI DLC jobs, and ModelScope publications with sensible defaults.

  • Reads credentials

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. About 0 are common, 14 are distinctive, and 14 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 14

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for language-model SFT, DPO, or GRPO when the user describes the job in natural language instead of handing over finished …

    line 8
  2. Very specific:

    Run scripts/training_workspace.py with the user's exact request text.

    line 25
  3. Distinctive:

    Before the first real PAI DLC submission, check whether these four values are already available:

    line 37
  4. Distinctive:

    If any are missing:

    line 44
  5. Very specific:

    Create configs/pai.required.env with blank placeholders.

    line 46
  6. Distinctive:

    Stop before real submission.

    line 49
  7. Distinctive:

    Do not skip this pause.

    line 51
  8. Distinctive:

    Read the user request and infer method, model, dataset, and training parameters.

    line 71
  9. Very specific:

    If configs/pai.required.env was created, stop and wait for continue.

    line 74
  10. Distinctive:

    Run a pilot job first:

    line 75
  11. Distinctive:

    Only after a successful pilot, run the full job:

    line 77
  12. Very specific:

    Use SFT by default.

    line 83
  13. Very specific:

    Use DPO only when the user explicitly asks for it or the data clearly represents preference pairs.

    line 84
  14. Very specific:

    Use GRPO only when the user explicitly asks for reinforcement-style optimization or reward-based training.

    line 85
  15. Very specific:

    When method choice is ambiguous, prefer SFT.

    line 86
  16. Very specific:

    Keep remote user_command short and deterministic.

    line 98
  17. Very specific:

    Use REMOTE_ASSET_PATHS when local files must be visible inside PAI DLC.

    line 99
  18. Very specific:

    If the user provides a local dataset path anywhere in the workspace or as an absolute path, scripts/training_workspace.py should …

    line 100
  19. Distinctive:

    Never pretend a local path is available remotely without packaging or upload.

    line 101
  20. Very specific:

    Read references/training_methods.md when method choice is uncertain.

    line 106
  21. Very specific:

    Read references/troubleshooting.md when a remote job fails.

    line 107
  22. Very specific:

    Read references/pai_dlc_remote_one_shot.md for remote submission details.

    line 108
  23. Very specific:

    Read references/gguf_conversion.md only when export is requested.

    line 109
  24. Distinctive:

    Never force the user into a rigid prompt template.

    line 113
  25. Distinctive:

    Never skip the credential gate.

    line 114
  26. Distinctive:

    Never claim training has started if you only wrote config files.

    line 115
  27. Distinctive:

    Never overwrite an existing publish target without explicit approval.

    line 116
  28. Distinctive:

    Always keep a pilot stage before a costly full run unless the user explicitly asks to skip it.

    line 117

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ModelScope Model Trainer

Use this skill for language-model SFT, DPO, or GRPO when the user describes the job in natural language instead of handing over finished config files.

Request Style

  • Accept requests such as:
    • Use Qwen/Qwen2.5-7B-Instruct on my dataset for SFT.
    • 我想用 Qwen2.5 做 DPO,对齐数据在 ./data/prefs.jsonl,学习率 2e-5。
  • Infer missing fields instead of asking for a template.
  • Default policy:
    • Method: SFT
    • Model: Qwen/Qwen2.5-0.5B-Instruct
    • Train type: LoRA
    • Dataset: generate a small local dataset under data/<method>/ when the user does not provide one
    • Remote path: PAI DLC pilot first, then full run

Files You Must Create

Run scripts/training_workspace.py with the user's exact request text. That script must create:

  1. configs/training.plan.json
  2. configs/remote.auto.env
  3. configs/pilot.env
  4. configs/full.env
  5. configs/pai.required.env when the four required PAI fields are still missing

You may also call scripts/bootstrap_remote_assets.py for the same preparation flow.

Credential Gate

Before the first real PAI DLC submission, check whether these four values are already available:

  • ALIBABA_CLOUD_ACCESS_KEY_ID
  • ALIBABA_CLOUD_ACCESS_KEY_SECRET
  • PAI_REGION
  • PAI_WORKSPACE_ID

If any are missing:

  1. Create configs/pai.required.env with blank placeholders.
  2. Tell the user to fill that file.
  3. Tell the user to reply with exactly continue.
  4. Stop before real submission.

Do not skip this pause.

MODELSCOPE_API_TOKEN is still optional for the gate itself, but it is required later for remote asset upload or automatic publication.

Primary Scripts

  • scripts/training_workspace.py Natural-language request to config files.
  • scripts/submit_pai_dlc.py Remote submission and polling.
  • scripts/train_sft_example.py
  • scripts/train_dpo_example.py
  • scripts/train_grpo_example.py
  • scripts/dataset_inspector.py
  • scripts/estimate_cost.py
  • scripts/diagnose_dlc_report.py
  • scripts/convert_to_gguf.py

Workflow

  1. Read the user request and infer method, model, dataset, and training parameters.
  2. Run scripts/training_workspace.py --request "<user text>".
  3. Inspect the generated plan and env files.
  4. If configs/pai.required.env was created, stop and wait for continue.
  5. Run a pilot job first:
    • uv run scripts/submit_pai_dlc.py --env-file configs/remote.auto.env --mode pilot --wait --retry-once
  6. Only after a successful pilot, run the full job:
    • uv run scripts/submit_pai_dlc.py --env-file configs/remote.auto.env --mode full --wait
  7. Publish checkpoints to ModelScope when token and target repo are available.

Method Rules

  • Use SFT by default.
  • Use DPO only when the user explicitly asks for it or the data clearly represents preference pairs.
  • Use GRPO only when the user explicitly asks for reinforcement-style optimization or reward-based training.
  • When method choice is ambiguous, prefer SFT.

The generated default datasets follow ms-swift-friendly schemas:

  • SFT: chat messages
  • DPO: messages plus rejected_response
  • GRPO: messages plus solution

Command Rules

  • SFT uses swift sft.
  • DPO and GRPO use swift rlhf --rlhf_type dpo|grpo.
  • Keep remote user_command short and deterministic.
  • Use REMOTE_ASSET_PATHS when local files must be visible inside PAI DLC.
  • If the user provides a local dataset path anywhere in the workspace or as an absolute path, scripts/training_workspace.py should automatically append it to REMOTE_ASSET_PATHS and rewrite the training dataset path to ./remote_assets/....
  • Never pretend a local path is available remotely without packaging or upload.

Defaults And References

  • Low-risk defaults live in scripts/training_workspace.py.
  • Read references/training_methods.md when method choice is uncertain.
  • Read references/troubleshooting.md when a remote job fails.
  • Read references/pai_dlc_remote_one_shot.md for remote submission details.
  • Read references/gguf_conversion.md only when export is requested.

Guardrails

  • Never force the user into a rigid prompt template.
  • Never skip the credential gate.
  • Never claim training has started if you only wrote config files.
  • Never overwrite an existing publish target without explicit approval.
  • Always keep a pilot stage before a costly full run unless the user explicitly asks to skip it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.