🚀 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兆像素
- 裁剪:否
- 裁剪风格:无
- 裁剪纵横比:无
- 是否用于正则化数据:否
📄 许可证
本项目使用其他许可证。