π¨ SDXL Text-to-Image Generator
Generate stunning images from text prompts β works everywhere: local, Colab, Kaggle.
π Quick Start β 3 Ways
1οΈβ£ Local CLI (Like Ollama)
git clone https://huggingface.co/rajkr/sdxl-pokemon-lora
cd sdxl-pokemon-lora
pip install -r clients/requirements.txt
# Download once (~7GB), generate forever β auto-cached to ~/.cache/huggingface
python clients/generate.py "a majestic dragon flying over a crystal lake"
python clients/generate.py "an astronaut riding a horse on Mars" --steps 50 --guidance 8.0 --seed 42
python clients/generate.py --list-models
| GPU | Speed | Notes |
|---|---|---|
| RTX 4090 (24GB) | ~20s/image | Best |
| RTX 3090 (24GB) | ~25s/image | Great |
| Colab T4 (16GB) | ~60s/image | Free |
| Apple M-series | ~5min/image | Slow but works |
| CPU only | ~10min/image | Very slow |
2οΈβ£ Google Colab (FREE GPU)
Download and open this notebook in Colab, then set GPU Runtime:
Steps:
- Download the notebook from above link
- Upload to colab.research.google.com
- Set GPU: Runtime β Change runtime type β T4 GPU
- Run all cells β first run downloads ~7GB, then unlimited free generation
3οΈβ£ Kaggle (FREE GPU)
Steps:
- Download the notebook
- Create new Kaggle notebook β Upload
- Turn on GPU: Settings β Accelerator β GPU T4
- Run all cells
π οΈ Advanced: Python SDK
from diffusers import AutoPipelineForText2Image
import torch
# Downloads once (~7GB), then runs locally
pipe = AutoPipelineForText2Image.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
variant="fp16",
).to("cuda")
# Generate
image = pipe(
"a cute fire pokemon with blue flames, anime style",
num_inference_steps=30,
guidance_scale=7.5,
).images[0]
image.save("pokemon.png")
π¦ Files in this Repo
| File | Description |
|---|---|
train_sdxl_lora.py |
Full training script β fine-tune SDXL with LoRA on any image+caption dataset |
clients/generate.py |
CLI tool β python generate.py "prompt" β works like Ollama |
clients/requirements.txt |
pip install -r this for local setup |
clients/colab_notebook.ipynb |
Google Colab notebook (free T4 GPU) |
clients/kaggle_notebook.ipynb |
Kaggle notebook (free T4 GPU) |
π§ Training Your Own Model
Fine-tune SDXL with LoRA on your own dataset:
pip install torch torchvision diffusers transformers accelerate peft datasets xformers
git clone https://huggingface.co/rajkr/sdxl-pokemon-lora
cd sdxl-pokemon-lora
accelerate launch train_sdxl_lora.py
The LoRA weights will be pushed to: rajkr/sdxl-pokemon-lora
Training Specs
| Parameter | Value |
|---|---|
| Base Model | stabilityai/stable-diffusion-xl-base-1.0 |
| VAE | madebyollin/sdxl-vae-fp16-fix |
| Dataset | reach-vb/pokemon-blip-captions |
| Method | LoRA (rank=16) |
| Trainable Params | ~4.7M (vs. ~2.6B full UNet) |
| Batch Size | 2 Γ 4 (gradient accumulation) |
| Resolution | 1024Γ1024 |
| Epochs | 3 |
| LR | 1e-4 (AdamW, cosine) |
| Mixed Precision | fp16 |
| VRAM | ~20-24GB |
| Hardware | A100, A10G, RTX 4090 |
πΌοΈ Sample Prompts
python clients/generate.py "a majestic dragon flying over a crystal lake at sunset, epic fantasy art"
python clients/generate.py "an astronaut riding a horse on Mars, cinematic shot" --steps 50
python clients/generate.py "a cozy coffee shop interior with rain outside" --model stabilityai/stable-diffusion-2-1
python clients/generate.py "a futuristic city skyline at night with neon lights" --guidance 10
π Links
- Model Repo: https://huggingface.co/rajkr/sdxl-pokemon-lora
- Training Script:
train_sdxl_lora.py - Community Forum: https://huggingface.co/rajkr/sdxl-pokemon-lora/discussions
- Downloads last month
- -
Model tree for rajkr/sdxl-pokemon-lora
Base model
stabilityai/stable-diffusion-xl-base-1.0