🚀 reddy-v4
reddy-v4 是一個基於 black-forest-labs/FLUX.1-dev 的標準 PEFT LoRA 模型,可用於文本到圖像的生成任務。
🚀 快速開始
推理示例
import torch
from diffusers import DiffusionPipeline
model_id = 'black-forest-labs/FLUX.1-dev'
adapter_id = 'Unmapped2895/reddy-v4'
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
pipeline.load_lora_weights(adapter_id)
prompt = "Realistic wide shot photo of woman posing in a luxurious satin lingerie set, featuring a plunging bra, delicate thong and a classic garter belt with black stockings. The satin lingerie shimmers softly in the light, and the cut emphasizes both sophistication and a hint of allure. The lingerie is detailed with fine lace edges, highlighting her alluring figure. She elegantly styled hair as if getting ready for a formal event. The photo has a cinematic quality with rays of light and dramatic play of shadow and light"
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=832,
height=1216,
guidance_scale=3.5,
).images[0]
model_output.save("output.png", format="PNG")
✨ 主要特性
- 基於
black-forest-labs/FLUX.1-dev
基礎模型構建,屬於標準 PEFT LoRA 模型。
- 支持文本到圖像、圖像到圖像等多種生成任務。
- 訓練和推理過程中提供了詳細的參數設置。
📦 安裝指南
文檔未提及具體安裝步驟,暫不提供。
💻 使用示例
基礎用法
import torch
from diffusers import DiffusionPipeline
model_id = 'black-forest-labs/FLUX.1-dev'
adapter_id = 'Unmapped2895/reddy-v4'
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
pipeline.load_lora_weights(adapter_id)
prompt = "Realistic wide shot photo of woman posing in a luxurious satin lingerie set, featuring a plunging bra, delicate thong and a classic garter belt with black stockings. The satin lingerie shimmers softly in the light, and the cut emphasizes both sophistication and a hint of allure. The lingerie is detailed with fine lace edges, highlighting her alluring figure. She elegantly styled hair as if getting ready for a formal event. The photo has a cinematic quality with rays of light and dramatic play of shadow and light"
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=832,
height=1216,
guidance_scale=3.5,
).images[0]
model_output.save("output.png", format="PNG")
高級用法
文檔未提及高級用法示例,暫不提供。
📚 詳細文檔
驗證設置
- CFG:
3.5
- CFG Rescale:
0.0
- 步數:
20
- 採樣器:
FlowMatchEulerDiscreteScheduler
- 隨機種子:
42
- 分辨率:
832x1216
- 跳過層引導:無
注意:驗證設置不一定與訓練設置相同。
訓練設置
屬性 |
詳情 |
訓練輪數 |
10 |
訓練步數 |
2000 |
學習率 |
0.0001 |
學習率調度 |
常量 |
熱身步數 |
500 |
最大梯度值 |
2.0 |
有效批量大小 |
1 |
微批量大小 |
1 |
梯度累積步數 |
1 |
GPU 數量 |
1 |
梯度檢查點 |
啟用 |
預測類型 |
flow - matching (額外參數=['shift=3', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible', 'flux_lora_target=all']) |
優化器 |
adamw_bf16 |
可訓練參數精度 |
Pure BF16 |
基礎模型精度 |
no_change |
字幕丟棄概率 |
10.0% |
LoRA 秩 |
16 |
LoRA Alpha |
無 |
LoRA 丟棄率 |
0.1 |
LoRA 初始化風格 |
默認 |
數據集
reddy-v2-512
- 重複次數:10
- 圖像總數:13
- 寬高比桶總數:1
- 分辨率:0.262144 兆像素
- 是否裁剪:否
- 裁剪風格:無
- 裁剪寬高比:無
- 是否用作正則化數據:否
reddy-v2-1024
- 重複次數:10
- 圖像總數:5
- 寬高比桶總數:1
- 分辨率:1.048576 兆像素
- 是否裁剪:否
- 裁剪風格:無
- 裁剪寬高比:無
- 是否用作正則化數據:否
🔧 技術細節
文本編碼器在訓練過程中未進行訓練,推理時可複用基礎模型的文本編碼器。
📄 許可證
本項目使用其他許可證。具體許可證信息請參考相關文件。