🚀 Flux.1 Lite
Flux.1 Lite是一款从FLUX.1 - dev模型中提炼出来的80亿参数的变换器模型。它比原模型少占用7GB内存,运行速度快23%,同时保持了与原模型相同的精度(bfloat16),能有效释放你的创造力!
🚀 快速开始
文本转图像
Flux.1 Lite已准备好释放你的创造力!为获得最佳效果,我们强烈建议使用2.0至5.0之间的guidance_scale
,并将n_steps
设置在20至32之间。
import torch
from diffusers import FluxPipeline
torch_dtype = torch.bfloat16
device = "cuda"
model_id = "Freepik/flux.1-lite-8B"
pipe = FluxPipeline.from_pretrained(
model_id, torch_dtype=torch_dtype
).to(device)
prompt = "A close-up image of a green alien with fluorescent skin in the middle of a dark purple forest"
guidance_scale = 3.5
n_steps = 28
seed = 11
with torch.inference_mode():
image = pipe(
prompt=prompt,
generator=torch.Generator(device="cpu").manual_seed(seed),
num_inference_steps=n_steps,
guidance_scale=guidance_scale,
height=1024,
width=1024,
).images[0]
image.save("output.png")
✨ 主要特性
- 性能优化:与原模型相比,使用的RAM减少7GB,运行速度提高23%,同时保持相同的精度(bfloat16)。
- 版本更新:新版本使用新数据集进行训练,在蒸馏时涵盖了更广泛的指导值范围(2.0 - 5.0)和步数范围(20 - 32),数据集更多样且提示词更长,比之前的alpha版本取得了更好的效果。
📚 详细文档
模型信息
属性 |
详情 |
基础模型 |
black - forest - labs/FLUX.1 - dev |
任务类型 |
文本转图像 |
库名称 |
diffusers |
标签 |
flux、文本转图像 |
动机
受Ostris研究结果的启发,我们分析了每个块的输入和输出之间的均方误差(MSE),以量化它们对最终结果的贡献,结果显示出显著的差异性。并非所有块的贡献都是相等的,跳过早期的MMDiT或晚期的DiT块中的任何一个都会显著影响模型性能,而跳过中间的任何单个块对最终图像质量没有显著影响。
ComfyUI工作流
我们还精心制作了一个ComfyUI工作流,让使用Flux.1 Lite更加无缝!可在comfy/flux.1 - lite_workflow.json
中找到它。
试用地址
我们的AI生成器现在由Flux.1 Lite提供支持!
最新消息
- 2024年12月30日:Flux.1 Lite 8B新训练模型在[HuggingFace仓库](https://huggingface.co/Freepik/flux.1 - lite - 8B)公开可用。
- 2024年10月23日:Alpha 8B检查点在[HuggingFace仓库](https://huggingface.co/Freepik/flux.1 - lite - 8B - alpha)公开可用。
引用信息
如果您觉得我们的工作有帮助,请引用它!
@article{flux1-lite,
title={Flux.1 Lite: Distilling Flux1.dev for Efficient Text-to-Image Generation},
author={Daniel Verdú, Javier Martín},
email={dverdu@freepik.com, javier.martin@freepik.com},
year={2024},
}
📄 许可证
本项目采用[flux - 1 - dev - non - commercial - license](https://huggingface.co/black - forest - labs/FLUX.1 - dev/resolve/main/LICENSE.md)许可证。
