llama-factory

Guides fine-tuning of large language models using LLaMA-Factory with LoRA, QLoRA, and WebUI workflows.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/hanasho744/codex --skill llama-factory-hanasho744
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: llama-factory
Source: https://github.com/hanasho744/codex/tree/main/.agents/skills/llama-factory
Command: npx skills add https://github.com/hanasho744/codex --skill llama-factory-hanasho744

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Fine-tuning large language models requires navigating complex training configurations, quantization methods, dataset formats, and distributed setups. This Skill provides expert guidance from official LLaMA-Factory documentation so you can configure, train, evaluate, and export models without memorizing every parameter. ## Core Features & Use Cases - Training Configuration Guidance: Covers supervised fine-tuning, pre-training, reward modeling, PPO, DPO, and KTO with LoRA, QLoRA (2-8 bit), Freeze, and full-parameter methods across 100+ models like Llama, Qwen, and Gemma. - WebUI No-Code Workflows: Explains how to train, evaluate, chat, and export models through the Gradio-based WebUI without writing code. - Advanced Topics: Details quantization (GPTQ, AWQ, bitsandbytes, HQQ, EETQ), distributed training (DDP, DeepSpeed, FSDP), NPU support, multimodal datasets, and monitoring with TensorBoard, Wandb, or SwanLab. - Use Case: You want to fine-tune Llama-3-8B on a custom Alpaca-format dataset using 4-bit QLoRA on a single GPU, then merge and export the adapter. This Skill walks you through dataset_info.json setup, the YAML training config, and the merge command. ## Quick Start Ask how to fine-tune a model with LLaMA-Factory, for example: show me the LoRA SFT configuration for Llama-3 on my custom dataset.

Frequently Asked Questions about llama-factory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fine-tune Llama 3 with LoRA using LLaMA-Factory?▼

Create a YAML config specifying model_name_or_path, stage: sft, finetuning_type: lora, your dataset, and template, then run llamafactory-cli train with that config. The examples/train_lora/llama3_lora_sft.yaml file provides a working template.

How to prepare a custom dataset for LLaMA-Factory training?▼

Register your dataset in data/dataset_info.json and format it as Alpaca or ShareGPT style. Alpaca uses instruction, input, and output columns; preference datasets need chosen and rejected columns, and multimodal data requires images, videos, or audio columns.

Does LLaMA-Factory support 4-bit QLoRA fine-tuning?▼

Yes, LLaMA-Factory supports 2/3/4/5/6/8-bit QLoRA via AQLM, AWQ, GPTQ, bitsandbytes, HQQ, and EETQ. Set quantization_method and quantization_bit in your config while keeping finetuning_type as lora.

Can I use LLaMA-Factory without writing code?▼

Yes, run llamafactory-cli webui to launch a Gradio interface with tabs for training, evaluation, chat, and export. You select the model, dataset, and parameters through dropdowns and start training with one click.

How do I merge LoRA adapters in LLaMA-Factory?▼

Run llamafactory-cli export with a merge config specifying model_name_or_path, adapter_name_or_path, template, and export_dir. Do not use a quantized base model or set quantization bits when merging adapters.

Why does LLaMA-Factory training fail on Ascend NPU?▼

Common causes include missing torch-npu, incorrect CANN toolkit versions, or CUDA hardcoding in model code. Replace CUDA_VISIBLE_DEVICES with ASCEND_RT_VISIBLE_DEVICES and verify installation with the torch_npu availability check script.