je-suis-tm/wong_kar_wai_my_blueberry_nights_lora_flux
119
Wong Kar Wai My Blueberry Nights style Lora Flux1
<Gallery />
All files are also archived in https://github.com/je-suis-tm/huggingface-archive in case this gets censored.
Wong Kar Wai is one of my fav directors. This LoRA intends to replicate that grainy, saturated jewel tone, dimly-lit vibe of the movie My Blueberry Nights (2007).
The training is based on https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora_flux.py. The training took 2 hours on A100 80GB with max VRAM consumption at 35GB. The inference consumes 36GB of VRAM.
Train
export MODEL_NAME="black-forest-labs/FLUX.1-dev"
export INSTANCE_DIR="/pvol/wong_kar_wai_my_blueberry_nights"
export OUTPUT_DIR="/pvol/wong_kar_wai_my_blueberry_nights_lora_flux"
accelerate config default
accelerate launch train_dreambooth_lora_flux1.py \
--pretrained_model_name_or_path=$MODEL_NAME \
--mixed_precision="bf16" \
--dataset_name=$INSTANCE_DIR \
--output_dir=$OUTPUT_DIR \
--gradient_checkpointing \
--instance_prompt="WKW style" \
--caption_column="text" \
--resolution=800 \
--center_crop \
--train_batch_size=1 \
--guidance_scale=1 \
--use_8bit_adam \
--checkpointing_steps=100 \
--gradient_accumulation_steps=4 \
--optimizer="adamW" \
--learning_rate=1e-4 \
--lr_scheduler="constant" \
--lr_warmup_steps=100 \
--max_train_steps=1500 \
--rank=4 \
--seed="0" Usage
import torch
from diffusers import FluxPipeline
device = "cuda:0"
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
pipe.load_lora_weights("je-suis-tm/wong_kar_wai_my_blueberry_nights_lora_flux",
weight_name='pytorch_lora_weights.safetensors')
prompt = "WKW Style, A woman in a yellow dress with a lace trimmed cowboy hat poses against a weathered brick column. tan brick columns forms the backdrop, punctuated by a glimpse of a vehicle"
image = pipe(
prompt=prompt,
generator=torch.Generator(device=device).manual_seed(42),
num_inference_steps=50, # 28 is a good trade-off
guidance_scale=4,
height=800,
width=1456, #the movie was in a weird resolution 800*1912 but flux1 only supports square aspect ratio training
).images[0]
image.save("wong_kar_wai_my_blueberry_nights.png")Trigger words
You should use WKW style to trigger the image generation.
Download model
Download them in the Files & versions tab.
