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
In this repository15 other files it gives its agents.
- agents/AGENTS.mdAGENTS.md
- modelscope-cliSkill
- modelscope-dataset-explorerSkill
- modelscope-datasetsSkill
- modelscope-evaluationSkill
- gradioSkill
- modelscope-jobsSkill
- modelscope-local-trainerSkill
- modelscope-local-vision-trainerSkill
- modelscope-mcpSkill
- modelscope-paper-publisherSkill
- modelscope-tool-builderSkill
- modelscope-trackingSkill
- modelscope-vision-trainerSkill
- transformers-jsSkill
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
- Distinctive: line 8
Use this skill for language-model SFT, DPO, or GRPO when the user describes the job in natural language instead of handing over finished …
- Very specific: line 25
Run scripts/training_workspace.py with the user's exact request text.
- Distinctive: line 37
Before the first real PAI DLC submission, check whether these four values are already available:
- Distinctive: line 44
If any are missing:
- Very specific: line 46
Create configs/pai.required.env with blank placeholders.
- Distinctive: line 49
Stop before real submission.
- Distinctive: line 51
Do not skip this pause.
- Distinctive: line 71
Read the user request and infer method, model, dataset, and training parameters.
- Very specific: line 74
If configs/pai.required.env was created, stop and wait for continue.
- Distinctive: line 75
Run a pilot job first:
- Distinctive: line 77
Only after a successful pilot, run the full job:
- Very specific: line 83
Use SFT by default.
- Very specific: line 84
Use DPO only when the user explicitly asks for it or the data clearly represents preference pairs.
- Very specific: line 85
Use GRPO only when the user explicitly asks for reinforcement-style optimization or reward-based training.
- Very specific: line 86
When method choice is ambiguous, prefer SFT.
- Very specific: line 98
Keep remote user_command short and deterministic.
- Very specific: line 99
Use REMOTE_ASSET_PATHS when local files must be visible inside PAI DLC.
- Very specific: line 100
If the user provides a local dataset path anywhere in the workspace or as an absolute path, scripts/training_workspace.py should …
- Distinctive: line 101
Never pretend a local path is available remotely without packaging or upload.
- Very specific: line 106
Read references/training_methods.md when method choice is uncertain.
- Very specific: line 107
Read references/troubleshooting.md when a remote job fails.
- Very specific: line 108
Read references/pai_dlc_remote_one_shot.md for remote submission details.
- Very specific: line 109
Read references/gguf_conversion.md only when export is requested.
- Distinctive: line 113
Never force the user into a rigid prompt template.
- Distinctive: line 114
Never skip the credential gate.
- Distinctive: line 115
Never claim training has started if you only wrote config files.
- Distinctive: line 116
Never overwrite an existing publish target without explicit approval.
- Distinctive: line 117
Always keep a pilot stage before a costly full run unless the user explicitly asks to skip it.
≈ “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.
Files
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
- Method:
Files You Must Create
Run scripts/training_workspace.py with the user's exact request text. That script must create:
configs/training.plan.jsonconfigs/remote.auto.envconfigs/pilot.envconfigs/full.envconfigs/pai.required.envwhen 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_IDALIBABA_CLOUD_ACCESS_KEY_SECRETPAI_REGIONPAI_WORKSPACE_ID
If any are missing:
- Create
configs/pai.required.envwith blank placeholders. - Tell the user to fill that file.
- Tell the user to reply with exactly
continue. - 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.pyNatural-language request to config files.scripts/submit_pai_dlc.pyRemote submission and polling.scripts/train_sft_example.pyscripts/train_dpo_example.pyscripts/train_grpo_example.pyscripts/dataset_inspector.pyscripts/estimate_cost.pyscripts/diagnose_dlc_report.pyscripts/convert_to_gguf.py
Workflow
- Read the user request and infer method, model, dataset, and training parameters.
- Run
scripts/training_workspace.py --request "<user text>". - Inspect the generated plan and env files.
- If
configs/pai.required.envwas created, stop and wait forcontinue. - Run a pilot job first:
uv run scripts/submit_pai_dlc.py --env-file configs/remote.auto.env --mode pilot --wait --retry-once
- 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
- Publish checkpoints to ModelScope when token and target repo are available.
Method Rules
- Use
SFTby default. - Use
DPOonly when the user explicitly asks for it or the data clearly represents preference pairs. - Use
GRPOonly 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: chatmessagesDPO:messagesplusrejected_responseGRPO:messagesplussolution
Command Rules
SFTusesswift sft.DPOandGRPOuseswift rlhf --rlhf_type dpo|grpo.- Keep remote
user_commandshort and deterministic. - Use
REMOTE_ASSET_PATHSwhen 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.pyshould automatically append it toREMOTE_ASSET_PATHSand 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.mdwhen method choice is uncertain. - Read
references/troubleshooting.mdwhen a remote job fails. - Read
references/pai_dlc_remote_one_shot.mdfor remote submission details. - Read
references/gguf_conversion.mdonly 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.
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
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.

