🚀 reddy-v2
reddy-v2是一個標準的PEFT LoRA,源自black-forest-labs/FLUX.1-dev,可用於文本到圖像的生成任務。
🚀 快速開始
推理示例
以下是使用reddy-v2
進行推理的示例代碼:
import torch
from diffusers import DiffusionPipeline
model_id = 'black-forest-labs/FLUX.1-dev'
adapter_id = 'Unmapped2895/reddy-v2'
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"
from optimum.quanto import quantize, freeze, qint8
quantize(pipeline.transformer, weights=qint8)
freeze(pipeline.transformer)
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=2.0,
).images[0]
model_output.save("output.png", format="PNG")
✨ 主要特性
- 基於
black-forest-labs/FLUX.1-dev
基礎模型,通過PEFT LoRA技術進行微調。
- 支持文本到圖像、圖像到圖像等多種生成任務。
- 訓練過程中使用特定的驗證提示和設置,確保生成圖像的質量。
📚 詳細文檔
驗證設置
- CFG:
2.0
- CFG Rescale:
0.0
- Steps:
20
- Sampler:
FlowMatchEulerDiscreteScheduler
- Seed:
42
- Resolution:
832x1216
- Skip-layer guidance:無
注意:驗證設置不一定與訓練設置相同。
你可以在以下圖庫中找到一些示例圖像:
文本編碼器未進行訓練,推理時可複用基礎模型的文本編碼器。
訓練設置
屬性 |
詳情 |
訓練輪數 |
3 |
訓練步數 |
600 |
學習率 |
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 |
基礎模型精度 |
int8 - quanto |
字幕丟棄概率 |
0.0% |
LoRA Rank |
32 |
LoRA Alpha |
無 |
LoRA Dropout |
0.1 |
LoRA初始化風格 |
默認 |
數據集
reddy - v2 - 512
- 重複次數:10
- 圖像總數:13
- 縱橫比桶總數:1
- 分辨率:0.262144兆像素
- 裁剪:否
- 裁剪風格:無
- 裁剪縱橫比:無
- 是否用於正則化數據:否
reddy - v2 - 1024
- 重複次數:10
- 圖像總數:5
- 縱橫比桶總數:1
- 分辨率:1.048576兆像素
- 裁剪:否
- 裁剪風格:無
- 裁剪縱橫比:無
- 是否用於正則化數據:否
📄 許可證
本項目使用其他許可證。