🚀 Flux.1 Lite
Flux.1 Lite是一款从FLUX.1 - dev模型中提炼出来的80亿参数的Transformer模型。与原模型相比,它能节省7GB的内存,运行速度提升23%,同时还能保持相同的精度(bfloat16)。
🚀 快速开始
环境要求
本模型仅由 gpustack/llama - box v0.0.84+ 提供实验性支持。
模型信息
- 模型创建者:Freepik
- 原始模型:[flux.1 - lite - 8B - alpha](https://huggingface.co/Freepik/flux.1 - lite - 8B - alpha)
- GGUF量化:基于由llama - box打补丁的stable - diffusion.cpp [ac54e](https://github.com/leejet/stable - diffusion.cpp/commit/ac54e0076052a196b7df961eb1f792c9ff4d7f22)
量化信息
量化方式 |
OpenAI CLIP ViT - L/14量化 |
Google T5 - xxl量化 |
VAE量化 |
FP16 |
FP16 |
FP16 |
FP16 |
Q8_0 |
FP16 |
Q8_0 |
FP16 |
(纯) Q8_0 |
Q8_0 |
Q8_0 |
FP16 |
Q4_1 |
FP16 |
Q8_0 |
FP16 |
Q4_0 |
FP16 |
Q8_0 |
FP16 |
(纯) Q4_0 |
Q4_0 |
Q4_0 |
FP16 |
模型示例图

✨ 主要特性
文本到图像转换
Flux.1 Lite能够将文本描述转化为图像,为用户带来丰富的创意体验。为了获得最佳效果,强烈建议使用 guidance_scale
为3.5,并将 n_steps
设置在22到30之间。
性能优化
相比原模型,Flux.1 Lite使用的内存更少,运行速度更快,同时保持了相同的精度。
💻 使用示例
基础用法
import torch
from diffusers import FluxPipeline
base_model_id = "Freepik/flux.1-lite-8B-alpha"
torch_dtype = torch.bfloat16
device = "cuda"
model_id = "Freepik/flux.1-lite-8B-alpha"
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")
🔧 技术细节
动机
受 [Ostris](https://ostris.com/2024/09/07/skipping - flux - 1 - dev - blocks/) 研究结果的启发,我们分析了每个块的输入和输出之间的均方误差(MSE),以量化它们对最终结果的贡献,结果显示出显著的差异。
块贡献分析
并非所有块的贡献都是相等的。跳过早期的MMDiT或后期的DiT块中的任何一个都会显著影响模型性能,而跳过中间的任何单个块对最终图像质量没有显著影响。
示例图

📚 详细文档
未来工作
我们的目标是进一步提炼FLUX.1 - dev,使其能够在24GB消费级GPU卡上平稳运行,保持其原始精度(bfloat16),并提高运行速度,让每个人都能使用高质量的AI模型。
ComfyUI支持
我们还创建了一个ComfyUI工作流,使Flux.1 Lite的使用更加无缝!可以在 comfy/flux.1 - lite_workflow.json
中找到它。

检查点文件
safetensors检查点文件可在此处获取:[flux.1 - lite - 8B - alpha.safetensors](flux.1 - lite - 8B - alpha.safetensors)
Hugging Face空间
感谢 TheAwakenOne,你也可以在 [Flux.1 Lite HF空间](https://huggingface.co/spaces/TheAwakenOne/flux1 - lite - 8B - alpha) 上测试该模型。
Freepik试用
我们的 [AI生成器](https://www.freepik.com/pikaso/ai - image - generator) 现在由Flux.1 Lite提供支持!
最新消息
- 2024年10月28日:Flux.1 Lite 8B Alpha的HF空间在 [HF Space](https://huggingface.co/spaces/TheAwakenOne/flux1 - lite - 8B - alpha) 上可用。
- 2024年10月23日:8B的Alpha检查点在 [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] 模型由Black Forest Labs. Inc.根据FLUX.1 [dev] 非商业许可证授权。版权归Black Forest Labs. Inc.所有。我们的模型权重根据FLUX.1 [dev] 非商业许可证发布。