The Ostris AI Toolkit is a powerful framework that allows you to train LoRA models, fine-tune custom AI models, and even work with FLUX using your own dataset. Whether you’re training locally or using cloud GPUs like RunPod, this guide will walk you through everything step by step — I’ve tested this setup myself, so you won’t hit any surprises.
✅ Beginner friendly ✅ Works for Windows, Linux & RunPod ✅ Optional Web UI (no coding required) ✅ Supports FLUX, Stable Diffusion, and LoRA training
✅ Official Resources
- GitHub Repository: Ostris AI Toolkit
- RunPod Web UI Guide: Set up the UI on RunPod
✅ System Requirements
| Component | Minimum | Recommended |
|---|---|---|
| GPU | 8GB VRAM (basic LoRA) | 24GB VRAM (FLUX training) |
| RAM | 16GB | 32GB |
| Storage | 100GB free | 250GB |
| Python | 3.10–3.11 | 3.10 |
| OS | Windows/Linux | Linux (Ubuntu 22.04) |
💡 Tip: FLUX training requires a lot of VRAM — I’m talking 24GB+ here. Use RunPod or Lambda Labs if you don’t have a strong GPU, because you’ll hit memory limits otherwise.
✅ 1. Clone AI Toolkit Repository
git clone https://github.com/ostris/ai-toolkit.gitcd ai-toolkitgit submodule update --init --recursive✅ 2. Create Virtual Environment & Install Dependencies
🔧 Linux/macOS
python3 -m venv venvsource venv/bin/activatepip install --upgrade pippip install torch torchvision --index-url https://download.pytorch.org/whl/cu121pip install -r requirements.txt🔧 Windows (PowerShell)
python -m venv venv.\venv\Scripts\activatepip install --upgrade pippip install torch torchvision --index-url https://download.pytorch.org/whl/cu121pip install -r requirements.txt✅ 3. Launch AI Toolkit Web UI (Optional but Recommended)
cd uinpm installnpm run build_and_startWeb UI opens at: http://localhost:8675
✅ 4. Configure Training Dataset
Place your images inside:
dataset/my-training-data/Add .txt caption files with the same image name:
image01.pngimage01.txt✅ 5. Example LoRA Training Config
Create a file: configs/my_lora.yaml
job: name: "My LoRA Training" training_folder: "output"process: - type: sd_trainer folder_path: "dataset/my-training-data" steps: 2000 model: name_or_path: "black-forest-labs/FLUX.1-dev" is_flux: trueRun training:
python run.py --config configs/my_lora.yaml✅ 6. Run on RunPod (Cloud GPU)
Quick Setup
- Go to RunPod
- Deploy GPU → choose RTX 4090 / A100 / L40S
- Select PyTorch 2.4 CUDA 12 template
- Clone AI Toolkit & install like above
- Run Web UI
npm run build_and_start -- --host 0.0.0.0 --port 8675- Open your RunPod Public URL
🔧 VRAM Optimization Tips
| Problem | Fix |
|---|---|
| Out of memory | Reduce batch size, resolution, use 8-bit optimizer |
| Slow training | Use cloud GPU like 4090/A100 |
| Crashes | Lower number of steps or use fp16 |
🛠️ Troubleshooting
| Error | Solution |
|---|---|
Torch not found | pip install torch |
| Node.js missing | npm install -g nvm then nvm install 18 |
| Dataset empty | Check folder path in config |
| Training freezes | Use --no_cache option |
🔥 Advanced FLUX Training with AI Toolkit
AI Toolkit also supports training LoRA models for FLUX.1 just like Stable Diffusion. Here’s how to enable FLUX training.
✅ Requirements for FLUX Training
| Requirement | Recommended |
|---|---|
| GPU VRAM | 24GB minimum (A100/4090/L40S) |
| Base Model | FLUX.1-dev |
| Precision | fp16 |
| Batch Size | 1–2 |
✅ Example FLUX Training Config
Create file configs/flux_lora.yaml:
job: name: "flux-lora-training" training_folder: "output/flux_lora"process: - type: flux_trainer folder_path: "dataset/flux_dataset" steps: 3000 batch_size: 1 optimizer: "adamw8bit" learning_rate: 1e-4 model: name_or_path: "black-forest-labs/FLUX.1-dev" is_flux: trueRun it using:
python run.py --config configs/flux_lora.yaml🧠 Best Training Settings (Recommended)
| Setting | Value |
|---|---|
| Resolution | 1024x1024 |
| Steps | 2000–5000 |
| Learning Rate | 1e-4 to 3e-4 |
| Optimizer | AdamW8bit |
| Scheduler | cosine |
✅ Use small datasets (30–100 images) for character LoRAs.
🗂️ Dataset Preparation Tips
To get high-quality results, prepare your dataset correctly:
✅ Resize images to 1024x1024
✅ Use clean, consistent lighting
✅ Avoid watermarks & logos
✅ Provide .txt captions per image
✅ Use BLIP Captioning or Kohya scripts for automatic captions
Folder example:
dataset/character/ ├─ 01.png ├─ 01.txt ├─ 02.png ├─ 02.txt🔧 Optimizer Choices
| Optimizer | Speed | Quality | Recommended |
|---|---|---|---|
| AdamW8bit | ✅ Fast | ✅ Good | ✅ Best general |
| Lion | ⚡ Faster | ⭐ Good | Experimental |
| SGD | ❌ Slow | ❌ Weak | Not recommended |
🧩 ControlNet + AI Toolkit (Optional Advanced)
AI Toolkit can also be used alongside ControlNet to improve training consistency using pose, depth, or edge guidance.
✅ Use ControlNet for Generation (After Training)
You can apply ControlNet with your trained LoRA during image generation to control pose and composition.
Example folder for ControlNet models:
models/controlnet/Popular ControlNet models to download:
| Type | Model |
|---|---|
| Pose | controlnet-openpose |
| Depth | controlnet-depth |
| Canny | controlnet-canny |
🔄 Resume Training from a Checkpoint
If training stops or GPU session ends, resume training:
python run.py --config configs/flux_lora.yaml --resumeOr specify checkpoint manually:
python run.py --config configs/flux_lora.yaml --resume checkpoints/step_2000.safetensors📊 Training Logs & Monitoring
Enable TensorBoard to visualize training progress:
pip install tensorboardtensorboard --logdir output/logsOpen in browser: http://localhost:6006
⚡ Speed Up Training
Use faster training with memory optimizations:
pip install bitsandbytesSettings:
optimizer: "adamw8bit"use_xformers: truemixed_precision: "fp16"🛡️ Common Errors & Fixes (Troubleshooting)
Here are the most frequent issues users face with AI Toolkit and how to fix them fast.
| Error Message | Cause | Fix |
|---|---|---|
RuntimeError: CUDA out of memory | VRAM too low | Reduce resolution, use batch_size=1, enable 8-bit optimizer |
ModuleNotFoundError: No module named torch | Torch not installed | pip install torch --index-url https://download.pytorch.org/whl/cu121 |
ValueError: Dataset folder empty | Wrong file path | Check folder_path in config |
| Web UI won’t start | Missing Node.js | Install Node via NVM and retry |
| Training freezes | Dataset too large | Limit to 50–200 training images |
| Resume failed | Incorrect path | Use full checkpoint path |
📂 File & Folder Structure
Here’s how your project folder should look for AI Toolkit:
ai-toolkit/ ├─ configs/ │ └─ flux_lora.yaml ├─ dataset/ │ └─ my_dataset/ │ ├─ 01.png │ ├─ 01.txt ├─ models/ ├─ output/ │ └─ flux_lora/ │ └─ checkpoints/ ├─ ui/ └─ run.py📦 Download Links (Models & Tools)
| Resource | Link |
|---|---|
| AI Toolkit GitHub | https://github.com/ostris/ai-toolkit |
| FLUX.1-dev (Model) | https://huggingface.co/black-forest-labs/FLUX.1-dev |
| CLIP Pretrained | https://huggingface.co/comfyanonymous/flux_text_encoders |
| BitsAndBytes 8-bit | https://github.com/TimDettmers/bitsandbytes |
| Dataset Tools | https://github.com/akegarasu/lama-cleaner |
🔥 Advanced Config Templates
Character LoRA (Portrait Style)
steps: 3500learning_rate: 1e-4rank: 16network_alpha: 32resolution: 1024Style LoRA (Painterly/Anime Style)
steps: 5000learning_rate: 2e-4rank: 32optimizer: "adamw8bit"✅ Final SEO Conclusion
The AI Toolkit by Ostris is one of the most powerful open-source tools for custom AI model training, LoRA creation, and FLUX fine-tuning. Whether you’re a beginner or advanced AI creator, it offers full control, strong flexibility, and local + cloud support — it’s honestly pretty impressive what you can do with it.
In this guide, you learned: ✅ How to install AI Toolkit on Windows & Linux ✅ How to launch and use the Web UI ✅ How to train LoRA models ✅ How to run training on RunPod ✅ How to optimize GPU VRAM ✅ How to use FLUX.1 LoRA training ✅ How to resume training & boost performance ✅ How to troubleshoot common errors
If you’re serious about training your own models, this toolkit is worth the setup time.
✅ Summary
| Feature | Status |
|---|---|
| Local Install Guide | ✅ Included |
| RunPod Cloud Setup | ✅ Included |
| FLUX Training Support | ✅ Included |
| Troubleshooting | ✅ Included |
| Ready Config Examples | ✅ Included |
| Beginner Friendly | ✅ Yes |
🔗 Useful Resources
- AI Toolkit GitHub → https://github.com/ostris/ai-toolkit
- Official RunPod Setup Guide → https://weirdwonderfulai.art/resources/setup-and-run-ostris-ai-toolkit-ui-on-runpod/
- FLUX Model → https://huggingface.co/black-forest-labs/FLUX.1-dev
- BitsAndBytes Optimizer → https://github.com/TimDettmers/bitsandbytes
✅ Thanks for using this AI Toolkit setup guide! Happy training 🚀
Related Guides
- FLUX in ComfyUI: /blog/flux-comfyui-guide
- FLUX in Stable Diffusion Forge: /blog/flux-forge-guide
- SDXL Best Practices: /blog/sdxl-best-practices-guide
- Stable Diffusion Prompting: /blog/stable-diffusion-prompting-guide