Instructions to use tengfeima-ai/dreambooth-sdxl-tfm-portrait with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use tengfeima-ai/dreambooth-sdxl-tfm-portrait with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("tengfeima-ai/dreambooth-sdxl-tfm-portrait") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
DreamBooth LoRA β Personal Portrait Subject (SDXL)
This is a LoRA fine-tuned version of Stable Diffusion XL 1.0 using the DreamBooth technique to teach the model a specific personal identity.
- Identifier token:
tfm - Class:
person - Base model:
stabilityai/stable-diffusion-xl-base-1.0 - Training technique: DreamBooth + LoRA (rank=32, applied to UNet + text encoders)
- Training steps: 1500
- Training images: 5 selfie portraits (1024Γ1024)
- Prior preservation: 200 class images
π WandB Training Run: https://wandb.ai/tengfeima/dreambooth-lora-sd-xl/runs/5s7v8lrc
Usage
import torch
from diffusers import StableDiffusionXLPipeline
# Disable buggy cudnn_sdp backend on newer PyTorch builds
torch.backends.cuda.enable_cudnn_sdp(False)
pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
)
pipe.load_lora_weights("tengfeima-ai/dreambooth-sdxl-tfm-portrait")
pipe = pipe.to("cuda")
# Generate with the identifier token
image = pipe(
"a photo of tfm person smiling, natural lighting, high quality portrait",
num_inference_steps=30,
guidance_scale=7.5,
).images[0]
image.save("output.png")
β οΈ Note: If you are using PyTorch β₯ 2.11.0, you may need to add
torch.backends.cuda.enable_cudnn_sdp(False)before loading the model to avoid a cuDNN SDPA backend error.
Prompt Tips
Use tfm person in your prompt to trigger the learned identity:
| Prompt | Expected Result |
|---|---|
a photo of tfm person, natural lighting |
Realistic portrait |
a painting of tfm person in the style of Van Gogh |
Artistic style transfer |
a photo of tfm person hiking in the mountains |
New environment |
a photo of a person smiling |
Generic person (prior preserved) |
Training Details
| Hyperparameter | Value |
|---|---|
| Base Model | SDXL 1.0 |
| LoRA Rank | 32 |
| Learning Rate | 1e-4 (constant) |
| Steps | 1500 |
| Batch Size | 1 (grad accum 4, effective 4) |
| Mixed Precision | bf16 |
| Resolution | 1024Γ1024 |
| Text Encoder | Fine-tuned (LoRA) |
| Prior Loss Weight | 1.0 |
| GPU | NVIDIA H100 80GB |
| Training Time | ~82 minutes |
| Final Loss | 0.00828 |
Repository Contents
βββ pytorch_lora_weights.safetensors # LoRA weights (227 MB, rank=32)
βββ training_images/ # 5 instance images used for training
βββ samples/
βββ neutral_portrait/ # 2 images β close to training distribution
βββ artistic_style/ # 2 images β Van Gogh & cyberpunk styles
βββ different_environment/ # 2 images β mountains & beach
βββ class_test_prior/ # 2 images β generic person (prior preservation test)
License
Apache 2.0 β feel free to use, modify, and redistribute with attribution.
- Downloads last month
- -
Model tree for tengfeima-ai/dreambooth-sdxl-tfm-portrait
Base model
stabilityai/stable-diffusion-xl-base-1.0