Views
No views yet
1from diffusers import StableDiffusionPipeline
2import torch
3
4# 加载基础模型
5pipe = StableDiffusionPipeline.from_pretrained(
6 "runwayml/stable-diffusion-v1-5",
7 torch_dtype=torch.float16
8)
9
10# 加载 LoRA 权重
11pipe.load_lora_weights("Chuenlye/bella-kotak-lora")
12
13# 生成图像
14prompt = "a beautiful portrait in the style of bella kotak"
15image = pipe(prompt).images[0]
16image.save("output.png")1uv run accelerate launch --num_cpu_threads_per_process=2 \
2 sd-scripts/train_network.py \
3 --pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5" \
4 --train_data_dir="/home/jovyan/bella_kotak_dataset" \
5 --output_dir="/home/jovyan/output/lora_bella_kotak" \
6 --resolution=512 \
7 --train_batch_size=2 \
8 --learning_rate=1e-4 \
9 --text_encoder_lr=5e-5 \
10 --unet_lr=1e-4 \
11 --max_train_epochs=50 \
12 --save_every_n_epochs=10 \
13 --mixed_precision="fp16" \
14 --gradient_checkpointing \
15 --cache_latents \
16 --network_module=networks.lora \
17 --network_dim=64 \
18 --network_alpha=64 \
19 --optimizer_type="AdamW8bit" \
20 --lr_scheduler="cosine"