ai-toolkit-trainer

Train custom LoRAs for WAN 2.2 and Z-Image models using ostris AI-Toolkit.

715|111|Updated Feb 15, 2026
One-click install
npx skills add https://github.com/artokun/comfyui-mcp --skill ai-toolkit-trainer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-toolkit-trainer
Source: https://github.com/artokun/comfyui-mcp/tree/main/plugin/skills/ai-toolkit-trainer
Command: npx skills add https://github.com/artokun/comfyui-mcp --skill ai-toolkit-trainer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Training custom LoRAs for WAN video and Z-Image models requires navigating AI-Toolkit installation, dataset formatting, GPU-specific Torch setup, and parameter tuning, which is error-prone without guidance.

Core Features & Use Cases

  • Guided Installation: Covers Windows V1/V2 installers and RunPod/Linux scripts with CUDA-aware Torch selection for Blackwell, Ada, Hopper, and Ampere GPUs.
  • Dataset & Parameter Guidance: Explains caption pairing, image vs video datasets, and starting parameters for WAN 2.2 (multi-stage MoE) and Z-Image (single-stream) training.
  • ComfyUI Integration: Shows how to load trained .safetensors LoRAs with LoraLoaderModelOnly in WAN dual-branch or Z-Image workflows.
  • Use Case: Train a character LoRA on 20 images with Z-Image Turbo on a 12GB GPU, then load it into a ComfyUI workflow and prompt with the trigger word.

Quick Start

Ask the AI to help you install AI-Toolkit and train a Z-Image LoRA from your dataset folder of captioned images.

Frequently Asked Questions about ai-toolkit-trainer

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

FAQPage Schema
How do I train a LoRA for WAN 2.2 video models?

Use ostris AI-Toolkit: prepare a dataset of images or short clips with matching .txt captions, create a job in the web UI, and enable Multi-stage training for both high-noise and low-noise experts. Start with rank 16, learning rate 5e-5, and 1500-2500 steps.

How to train a Z-Image LoRA on low VRAM?

Z-Image LoRA training runs on modest consumer GPUs using AdamW8bit optimizer with float8 quantization, batch size 1, and 512-768 resolution. Keep Multi-stage off since Z-Image is a single-stream model, and start with rank 16-32 at learning rate 1e-4.

Can I run AI-Toolkit on RunPod instead of locally?

Yes, the RunPod installer script sets up AI-Toolkit in /workspace/ai-toolkit on the persistent volume and is idempotent. Use the PyTorch 2.8.0 template with a 100GB disk, set AI_TOOLKIT_AUTH, and access the UI on port 8675 via the RunPod proxy URL.

What GPU do I need for WAN video LoRA training?

WAN image LoRAs need 24GB+ VRAM locally with quantization, while WAN video LoRAs, high resolution, or high rank jobs are best on cloud GPUs like RTX 5090 or RTX 6000 Pro. Z-Image image LoRAs are the lightest and train on smaller cards with float8.

Why does AI-Toolkit fail with 'No module named torchaudio'?

This error means the venv's Torch stack is mismatched. Activate the AI-Toolkit venv, uninstall torch, torchaudio, and torchvision, then reinstall them together from the correct PyTorch CUDA index URL for your GPU.

How do I use a trained LoRA in ComfyUI?

Copy the .safetensors file into ComfyUI's models/loras folder and load it with LoraLoaderModelOnly. WAN 2.2 requires applying the LoRA to both HighNoise and LowNoise branches, while Z-Image uses a single loader at strength 0.7-1.0.