llm-foundry
Use MosaicML LLM Foundry for LLM data preparation, Composer training and fine-tuning YAMLs, ICL evaluation, inference/export, registries, MPT/HF model configuration, and workflow troubleshooting.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- llm-foundry
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use MosaicML LLM Foundry for LLM data preparation, Composer training and fine-tuning YAMLs, ICL evaluation, inference/export, registries, MPT/HF model configuration, and workflow troubleshooting.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/repo-provenance.md2.5 KB
- 参考文档references/repo-routing-metadata.json550 B
- 参考文档references/troubleshooting.md4.4 KB
- 脚本scripts/check_llmfoundry_environment.py5.3 KB
03 SKILL.md 正文
LLM Foundry repo skill
Use this skill when a task is specifically about MosaicML LLM Foundry (llm-foundry / llmfoundry): preparing streaming LLM datasets, adapting Composer YAMLs for pretraining or fine-tuning, configuring in-context-learning evaluation, running inference/export helpers, inspecting package registries, or troubleshooting LLM Foundry installs and optional backends.
First checks
-
Confirm the task is about LLM Foundry rather than generic Hugging Face, Composer, vLLM, SGLang, Axolotl, LlamaFactory, or another LLM framework.
-
Verify the installed package before relying on CLI/API behavior:
python -c "from importlib.metadata import version; print(version('llm-foundry'))" python -c "import llmfoundry; print(llmfoundry.__version__)" llmfoundry --help -
For a non-invasive package and backend check, run scripts/check_llmfoundry_environment.py. It does not download models/data, train, evaluate, upload, or use credentials.
-
Read references/repo-provenance.md before deciding whether this skill is current for a checkout or whether
refresh-repo-skillis needed. -
For install/import, optional backend, credential, or large-run safety issues that cross workflows, read references/troubleshooting.md.
Route by task
| User task | Read |
|---|---|
Convert C4/Pile/JSON/raw text/fine-tuning data to MDS; validate JSONL prompt/response rows; plan StreamingDataset remote/local/split/cache fields; reason about Delta/Databricks export or contrastive pairs. |
sub-skills/data-preparation/SKILL.md |
| Create or adapt Composer YAMLs for pretraining, SFT/instruction fine-tuning, domain/sequence-length adaptation, callbacks/loggers/optimizers, checkpointing, resumption, MCLI training jobs, or bounded training smoke checks. | sub-skills/training-finetuning/SKILL.md |
Configure llmfoundry eval, custom ICL task JSONL, Eval Gauntlet aggregation, API-wrapper evaluation, in-training eval hooks, or evaluation result interpretation. |
sub-skills/evaluation/SKILL.md |
| Generate/chat with HF models, convert Composer checkpoints to HF folders, export ONNX, reason about FasterTransformer or endpoint generation prerequisites, or debug dtype/device/export/auth errors. | sub-skills/inference-conversion/SKILL.md |
| Inspect registries, MPT/HF model class signatures, tokenizers, callbacks, optimizers, schedulers, metrics, loggers, config transforms, optional package imports, or MosaicML platform/MCLI adaptation patterns. | sub-skills/package-apis-configuration/SKILL.md |
Installation and backend posture
-
Public install baseline:
python -m pip install llm-foundryUse an editable install only for a local checkout or extension development.
-
This skill's verified minimum operating scope is CPU/any package inspection plus safe CLI/help/static checks. A torch CUDA allocation was verified during construction, but advanced GPU stacks are intentionally not claimed as fully verified.
-
Treat these as optional until the user explicitly needs them and the target environment proves them:
flash_attn, TransformerEngine, MegaBlocks, FasterTransformer, ROCm, Intel Gaudi, multi-node distributed training/eval, MosaicML platform credentials, and private object-store/model credentials. -
For quick CPU/API work with MPT configs, prefer
attn_impl: torch. Useattn_impl: flashonly after flash-attn is installed for the exact torch/CUDA/Python/GPU stack.
Common safe commands
# CLI discovery
llmfoundry --help
llmfoundry registry get --group models
llmfoundry data_prep --help
llmfoundry train --help
llmfoundry eval --help
# Skill-bundled checks, run from this generated skill directory
python scripts/check_llmfoundry_environment.py --json
python sub-skills/data-preparation/scripts/llmfoundry_data_prep_smoke.py --help
python sub-skills/training-finetuning/scripts/llmfoundry_config_probe.py --help
python sub-skills/evaluation/scripts/llmfoundry_eval_config_lint.py --help
python sub-skills/inference-conversion/scripts/llmfoundry_inference_smoke.py --help
python sub-skills/package-apis-configuration/scripts/llmfoundry_api_probe.py --help
Safety rules
- Do not start training, evaluation, generation, conversion, Hub upload, endpoint calls, Databricks export, or object-store operations until model/data sizes, credentials, hardware, and budget are explicit.
- Keep secrets out of YAML examples and commands. Prefer environment variables or the platform's secret mechanism.
- Do not use CPU importability as proof of flash attention, TransformerEngine, MegaBlocks, FasterTransformer, distributed, or platform behavior.
- If a task is generic LLM usage with no LLM Foundry-specific CLI, config, registry, or data surface, choose a more appropriate generic LLM or framework skill instead.
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).