The ultimate training toolkit for finetuning diffusion models by Ostris.
System requirements: Python 3.10+, Nvidia GPU (recommended at least 8GB VRAM), Python virtual environment, Git.
git clone https://github.com/ostris/ai-toolkit.git
cd ai-toolkit
git submodule update --init --recursive
python3 -m venv venv
source venv/bin/activate
# install torch first
pip3 install --no-cache-dir torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu126
pip3 install -r requirements.txt
git clone https://github.com/ostris/ai-toolkit.git
cd ai-toolkit
git submodule update --init --recursive
python -m venv venv
.\\venv\\Scripts\\activate
pip install --no-cache-dir torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu126
pip install -r requirements.txt
Provides an intuitive web interface for easily starting, monitoring, and managing AI model training tasks without writing complex commands.
cd ui
npm run build_and_start
After launching, visit http://localhost:8675 to access all features
Set the environment variable AI_TOOLKIT_AUTH
to add password protection and prevent unauthorized access.
Provides a simpler Gradio graphical interface, especially suitable for beginners to quickly get started with model training, data processing, and LoRA publishing.
# After installing ai-toolkit
cd ai-toolkit
huggingface-cli login # Login to HF
python flux_train_ui.py
Supports training for the latest FLUX.1 diffusion models, providing industry-leading image generation quality. Hardware requirements: NVIDIA GPU with at least 24GB VRAM.
config/examples/
), modify parameters according to your needs.python run.py config/your_config_name.yml
Advanced tip: Adjusting learning rate, training steps, and batch size can significantly impact training results. Refer to official documentation for best practices.
High-quality training data is key to successful model training. AI Toolkit supports various data formats:
AI Toolkit provides multiple cloud training options, suitable for users without high-end GPUs or projects requiring large-scale training.
Provides complete RunPod templates and deployment scripts, supporting one-click deployment:
Provides serverless training solutions for the Modal platform:
Cloud training is ideal for large models and long-duration training. See official documentation for detailed configuration.
AI Toolkit provides fine-grained layer control for optimized training of specific network layers:
network:
type: "lora"
# ... other params
network_kwargs:
only_if_contains: ["layer_name_suffix"]
# or
ignore_if_contains: ["layer_name_suffix"]
By precisely controlling training layers, you can significantly improve generation quality for specific content types, such as facial details, textures, or specific styles.
Supports LoKr (Low-Rank Kronecker product) training method, providing more efficient parameter utilization:
network:
type: "lokr"
lokr_full_rank: true
lokr_factor: 8
# ... other params
LoKr technology can achieve better training results with fewer parameters, especially suitable for complex styles and detail-rich concepts.
Supports mixed precision training, significantly reducing VRAM requirements while maintaining model quality:
For more advanced training techniques and optimization methods, please refer to the Advanced Training Documentation.
Need more detailed usage guides or having issues? Visit the AI Toolkit GitHub Official Repository or join the Discord Community for help.