🚀 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 兆像素
- 是否裁剪:否
- 裁剪风格:无
- 裁剪宽高比:无
- 是否用作正则化数据:否
🔧 技术细节
文本编码器在训练过程中未进行训练,推理时可复用基础模型的文本编码器。
📄 许可证
本项目使用其他许可证。具体许可证信息请参考相关文件。