Skip to content

dadadies/ddd_Lora_Creator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DDD LoRA Creator

A simple, guided application for training LoRA models for Stable Diffusion 1.5 and SDXL.

Quick Start

cd lora_trainer
pip install -r requirements.txt
python main.py

The app opens at http://localhost:7860.

What This Is

One app. Open it, follow the steps, get a LoRA file ready for ComfyUI.

No command line. No scattered settings. No jargon.

How It Works

1. System Check - Verify GPU and environment
2. Pick your base model (SD 1.5 or SDXL, local or HuggingFace)
3. Import your images with captions
4. Choose what you're training (Style / Subject / Concept)
5. Review and start
6. Watch it train with live loss graph
7. Get your .safetensors file → drop into ComfyUI

Key Features

  • Data Augmentation: Automatic flip, color jitter, and affine transforms to improve generalization with small datasets
  • Shuffled Epochs: Each training epoch shuffles image order for better learning
  • Presets: Pre-configured settings for Style, Subject, and Concept training
  • Live Monitoring: Real-time loss graph during training
  • ComfyUI Integration: Auto-copy LoRA to ComfyUI folder (if detected)

Requirements

  • Python 3.10+
  • CUDA-capable GPU (6GB+ minimum, 8GB+ recommended for SD 1.5, 12GB+ for SDXL)
  • ~10GB disk space for models

Model Caching

When you download a base model from HuggingFace, it is cached on your disk for future use.

How It Works

Source What Happens
HuggingFace download Model downloads once (~2-7GB), stored in cache at ~/.cache/huggingface/hub/. Future runs use cached version - no re-download.
Local file Copied to a temp folder during loading, cleaned up after training. No persistent cache.

Cache Location

Windows: C:\Users\YOUR_USER\.cache\huggingface\hub\
Mac/Linux: ~/.cache/huggingface/hub/

Managing Cache

  • Cache persists between sessions - speeds up future runs
  • To free disk space: Delete the cache folder manually
  • To force re-download: Delete the specific model folder from cache

⚠️ Important: HuggingFace downloads are not automatically deleted after training. If you download SDXL and multiple SD 1.5 models, they will all stay in your cache占用 disk space.

Training Tips

Dataset Size Recommended
10-15 images Use data augmentation, 2500-3000 steps
15-30 images Augmentation optional, 3000-4000 steps
30+ images No augmentation needed, 3500-5000 steps

Rank recommendations:

  • Style LoRA: 64-128
  • Subject LoRA: 128-256
  • Concept LoRA: 64-128

Project Structure

ddd_Lora_Creator/
├── 01_what_is_lora.md          # LoRA basics for beginners
├── 02_lora_technology_and_architecture.md  # Technical deep-dive
├── 03_training_loras_and_using_in_comfyui.md  # Complete usage guide
└── lora_trainer/
    ├── main.py                 # Entry point
    ├── core/
    │   ├── pipeline.py         # Training loop
    │   ├── dataset.py          # Image loading + augmentation
    │   └── model.py            # Model loading + LoRA injection
    ├── ui/
    │   └── wizard.py           # Gradio interface
    └── presets/
        └── configurations.py   # Training presets

Captions

Each image needs a .txt file with the same name:

dataset/
  image_001.png
  image_001.txt   ← Include your trigger word, e.g.:
                    a woman with ddd_my_style, outdoor, natural lighting
  image_002.png
  image_002.txt   ← ddd_my_style, portrait, studio lighting

Using Your LoRA in ComfyUI

  1. Copy .safetensors to ComfyUI/models/loras/
  2. Add Load LoRA node after Load Checkpoint
  3. Set strength_model: 0.7-0.8
  4. Include trigger word in your prompt

About

A LORA creator for SD1.5 and SDXL. I created this because none of the LORA creators worked for me. This is the first LORA that worked. But its not accurate for some reason. I don't know if the code is wrong or I am using inproper settings. I will continue to update it whenever I can.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages