model-loading-and-export
Use for LlamaFactory model/tokenizer/processor loading, model patches, LoRA adapter loading/merge/export, export-time GPTQ quantization, on-the-fly quantization backends, value-head export, checkpoint utilities, and hub/cache/revision/trust settings.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-loading-and-export
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use for LlamaFactory model/tokenizer/processor loading, model patches, LoRA adapter loading/merge/export, export-time GPTQ quantization, on-the-fly quantization backends, value-head export, checkpoint utilities, and hub/cache/revision/trust settings.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/checkpoint-utilities.md4.2 KB
- 参考文档references/export-and-quantization.md6.0 KB
- 参考文档references/model-loading.md7.2 KB
- 参考文档references/troubleshooting.md6.1 KB
- 脚本scripts/check_export_config.py11.5 KB
03 SKILL.md 正文
Model Loading and Export
Use this sub-skill when an agent needs to load, patch, merge, quantize, export, or diagnose LlamaFactory v0 model artifacts for source behavior 0.9.6.dev0.
Route Here For
model_name_or_path,adapter_name_or_path, tokenizer/processor loading,trust_remote_code,cache_dir,model_revision, and hub tokens.- LoRA/OFT adapter load, resume, merge, export,
create_new_adapter,pissa_init,pissa_convert, value-head/RM checkpoints, andadditional_targetinteractions. llamafactory-cli export CONFIG.yamlorlmf export CONFIG.yaml, including adapter merge, full-model export, OllamaModelfile, tokenizer/processor saving, and hub push settings.- Quantization choices for PTQ models, QLoRA/on-the-fly training or inference, and export-time GPTQ quantization.
- Model patches and utilities such as vocab resize, RoPE/attention/kv-cache/kernel switches, MoD, Unsloth, Liger, KTransformers, and checkpoint conversion/init planning.
Boundaries
- Route training launch mechanics, dataset sampling, optimizers, distributed training, CLI overrides, and experiment tracking to
training-and-configs. - Route dataset registration, prompt templates, multimodal data schemas, and tokenizer-template fixes to
data-and-templatesunless the failure is directly in model/tokenizer/processor loading. - Route chat/API/Web UI/vLLM/SGLang serving behavior to
inference-and-servingunless the issue is model loading, adapter, or quantization setup. - Treat source checkpoint conversion and initialization utilities as reference-only plans unless the user explicitly authorizes large CPU/GPU and disk operations.
Start With
- Identify the operation: load, train-time adapter setup, export/merge, export quantization, or checkpoint utility.
- Read
references/model-loading.mdfor loader arguments, tokenizer/processor behavior, patches, adapters, and value-head concerns. - Read
references/export-and-quantization.mdbefore editing export YAML or choosing a quantization backend. - Read
references/checkpoint-utilities.mdbefore recommending PiSSA/LoftQ/LLaMA-Pro/DCP/other checkpoint conversions. - Read
references/troubleshooting.mdwhen errors mention tokenizer/processor loading, remote code, hub access, quantized vocab resize, adapter merge, optional dependencies, or hub mirrors.
Bundled Helper
scripts/check_export_config.pystatically checks YAML/JSON export configs for common LlamaFactory pitfalls without importing LlamaFactory, Transformers, PyTorch, or downloading models.
Safety
- Never run model downloads, adapter merges, export quantization, checkpoint conversion, or hub pushes without explicit user approval and a concrete output path.
- Do not put secrets in config files; prefer environment variables for hub tokens and mirror controls.
- Warn that quantized model merge/export operations are constrained: adapters must be merged before export quantization, and adapters cannot be merged into an already quantized model.
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).