Automated Stable Diffusion LoRA pipeline with dataset extraction, training, generation, and evaluation.
AutoLoraFactory is a Python-based automation pipeline for creating high-quality LoRA models from videos.
It automatically:
- extracts frames from videos
- detects and crops faces
- removes duplicate images
- selects high-quality samples
- generates captions
- trains LoRA models
- generates images
- evaluates outputs with CLIP
- selects the best checkpoint automatically
- Video frame extraction with FFmpeg
- Face detection using InsightFace
- Automatic face crop & resize
- Duplicate image removal
- Quality-based image filtering
- Automatic caption generation
- Fully automated LoRA training
- Hyperparameter search
- Automatic checkpoint evaluation
- Best model selection
- Batch experiment support
- CLIP similarity scoring
- Simple aesthetic scoring
- Automatic ranking system
Video (.mp4)
↓
Frame Extraction
↓
Face Detection & Crop
↓
Duplicate Removal
↓
Quality Filtering
↓
Caption Generation
↓
LoRA Training
↓
Image Generation
↓
CLIP Evaluation
↓
Best LoRA Selection
AutoLora/
├── input/ # Input videos
├── dataset/
│ └── 10_person/ # Training dataset
├── lora/ # Trained LoRA models
├── outputs/ # Generated images
├── best_lora/ # Best checkpoints
├── pipeline/
│ ├── extract.py
│ ├── train.py
│ ├── generate.py
│ ├── evaluate.py
│ └── utils.py
├── run.py
├── requirements.txt
├── LICENSE
└── README.md
- Python 3.10+
- CUDA GPU
- FFmpeg
- Stable Diffusion WebUI
- kohya_ss / sd-scripts
pip install \
torch \
torchvision \
diffusers \
transformers \
insightface \
opencv-python \
pillow \
tqdm \
imagehash \
xformersMake sure FFmpeg is installed and added to PATH.
ffmpeg -versionPlace your base model here:
C:/stable-diffusion-webui/models/Stable-diffusion/
Example:
v1-5-pruned-emaonly.safetensors
GitHub:
https://github.com/kohya-ss/sd-scripts
Place .mp4 files inside:
input/
python run.pyThe pipeline automatically handles:
- frame extraction
- face detection & crop
- duplicate removal
- quality filtering
- caption generation
- LoRA training
- image generation
- CLIP evaluation
- best checkpoint selection
Edit SEARCH in run.py.
SEARCH = {
"dim": [8, 16, 32],
"lr": [1e-4, 5e-5],
"steps": [1000, 2000]
}score = CLIP * 0.7 + aesthetic * 0.3Current metrics:
- CLIP similarity score
- simple brightness-based aesthetic score
python run.pyThat's it.
The pipeline handles the rest automatically.
- CUDA environment required
- Windows paths are currently hardcoded
- Designed for personal research / experimentation
- Path cleanup and config externalization recommended
This project was built in 2 days.
I do not accept ugly code.
I will probably not maintain this repository.
Use it, modify it, break it — do whatever you want.
This project is intended for research and educational purposes only.
Users are responsible for complying with applicable laws and platform policies.
MIT License
CyberSoulWing