Views
No views yet
export MODEL_NAME="black-forest-labs/FLUX.1-dev"
export INSTANCE_DIR="/pvol/wong_kar_wai_fallen_angels"
export OUTPUT_DIR="/pvol/wong_kar_wai_fallen_angels_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" 1import torch
2from diffusers import FluxPipeline
3
4device = "cuda:0"
5
6pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
7
8pipe.load_lora_weights("je-suis-tm/wong_kar_wai_fallen_angels_lora_flux",
9 weight_name='pytorch_lora_weights.safetensors')
10
11
12prompt = "WKW Style, a tilted view of a woman with long, dark
13 hair, clad in a blue dress, stands within a subway train. Her hand reaches
14 up to a metal overhead handle as she raises her chin, seemingly lost in
15 thought. her eyes are obscured by her bangs. The background suggests an
16 older subway train model, with indistinct windows and seats visible. The
17 scene evokes a quiet, peaceful atmosphere, hinting at a solitary journey or
18 a moment of reflection while waiting for her stop."
19
20image = pipe(
21 prompt=prompt,
22 generator=torch.Generator(device=device).manual_seed(42),
23 num_inference_steps=50, # 28 is a good trade-off
24 guidance_scale=4,
25 height=800,
26 width=1456, #the movie was in a weird resolution 1056*1912 but flux1 only supports square aspect ratio training
27).images[0]
28
29image.save("wong_kar_wai_fallen_angels.png")WKW style to trigger the image generation.