🚀 flux-lora-training
這是一個基於 black-forest-labs/FLUX.1-dev 的標準PEFT LoRA模型。它可用於文本到圖像、圖像到圖像等多種任務,為圖像生成提供了強大的支持。
✨ 主要特性
- 基於
black-forest-labs/FLUX.1-dev
基礎模型派生而來。
- 支持文本到圖像、圖像到圖像等多種圖像生成任務。
- 提供了詳細的訓練和驗證設置。
📦 安裝指南
文檔未提及具體安裝步驟,故跳過該章節。
💻 使用示例
基礎用法
import torch
from diffusers import DiffusionPipeline
model_id = 'black-forest-labs/FLUX.1-dev'
adapter_id = 'hok00i3/flux-lora-training'
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
pipeline.load_lora_weights(adapter_id)
prompt = "(ultra detailed,photo,photograph,best quality,high resolution,4k,8k,photorealistic,Japanese early twenties,(slim) and curvy body,waist,detailed beautiful eyes,super detailed eyes and skins,very beautiful woman:3.0), (Wearing tight short sleeves white (one piece) sailor uniform, blue collar, red neckerchief, dark blue pleated dress, standing in empty classroom,sweet smiling:2.0), long straight hair, standing in empty classroom,"
pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu')
model_output = pipeline(
prompt=prompt,
num_inference_steps=20,
generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
width=1024,
height=1024,
guidance_scale=3.5,
).images[0]
model_output.save("output.png", format="PNG")
📚 詳細文檔
驗證設置
- CFG:
3.5
- CFG Rescale:
0.0
- 步數:
20
- 採樣器:
FlowMatchEulerDiscreteScheduler
- 種子:
42
- 分辨率:
1024x1024
- 跳過層引導:
注意:驗證設置不一定與訓練設置相同。
你可以在以下圖庫中找到一些示例圖像:
文本編碼器未進行訓練。你可以重用基礎模型的文本編碼器進行推理。
訓練設置
-
訓練輪數:92
-
訓練步數:2400
-
學習率:0.0001
- 學習率調度:constant_with_warmup
- 預熱步數:100
-
最大梯度值:1.0
-
有效批量大小:1
-
梯度檢查點:True
-
預測類型:flow-matching (額外參數=['flow_schedule_auto_shift', 'shift=0.0', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible', 'flux_lora_target=all+ffs'])
-
優化器:adamw_bf16
-
可訓練參數精度:Pure BF16
-
基礎模型精度:no_change
-
字幕丟棄概率:0.0%
-
LoRA秩:16
-
LoRA Alpha:None
-
LoRA丟棄率:0.1
-
LoRA初始化風格:default
數據集
cissy
- 重複次數:0
- 圖像總數:26
- 縱橫比桶總數:1
- 分辨率:1.0兆像素
- 裁剪:true
- 裁剪風格:居中
- 裁剪縱橫比:方形
- 用於正則化數據:否
📄 許可證
許可證類型:other