🚀 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