瘦身7G,小显存也可以玩Flux了

财富   2024-11-05 09:00   山东  

Flux发布以来,以出色的画质吸引了广大AI绘画爱好者。

但是,Flux虽好,唯一的缺点是体积过大,对显存的消耗非常大。尤其是不进行量化的完整版,至少在16G显存上才能很好的跑起来(12G显存虽然能跑,但耗时漫长)。

我在做演示的时候,经常用FP8量化版本替代。

现在来了好消息,Freepik在开源Flux的基础上,对大模型进行了优化,从12B优化到了8B,节约了23%的体积。这就意味着,可以在更小的显存上跑起来。

经过我的实测,在3060 12G显卡上,bfloat16精度差不多1分钟以内可以跑出768*1024尺寸的图。虽然不算快,但属于勉强可以接受的范畴了。

另外,从版本来看,这是alpha,距离更完善、更快速还有一段距离,还有优化空间,未来可期。

开发者称:


Flux.1 Lite

我们很高兴地宣布 Flux.1 Lite 的 alpha 版本,这是一个从 FLUX.1-dev 模型中提炼出来的 8B 参数转换器模型。此版本使用的 RAM 减少了 7 GB,运行速度提高了 23%,同时保持与原始模型相同的精度 (bfloat16)。


文本转图像

Flux.1 Lite 已准备好释放您的创造力!为了获得最佳结果,我们强烈建议使用guidance_scale3.5 并设置n_steps在 22 到 30 之间

import torch from diffusers import FluxPipeline base_model_id = "Freepik/flux.1-lite-8B-alpha" torch_dtype = torch.bfloat16 device = "cuda" # Load the pipe model_id = "Freepik/flux.1-lite-8B-alpha" pipe = FluxPipeline.from_pretrained( model_id, torch_dtype=torch_dtype ).to(device) # Inference prompt = "A close-up image of a green alien with fluorescent skin in the middle of a dark purple forest" guidance_scale = 3.5 # Keep guidance_scale at 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研究结果的启发,我们分析了每个块的输入和输出之间的均方误差 (MSE),以量化它们对最终结果的贡献,揭示了显着的变异性。

正如奥斯特里斯指出的那样,并非所有区块的贡献都是平等的。虽然仅跳过早期 MMDiT 或晚期 DiT 块之一会显着影响模型性能,但跳过其间的任何单个块不会对最终图像质量产生重大影响。

未来的工作

敬请关注!我们的目标是进一步提炼 FLUX.1-dev,直到它可以在 24 GB 消费级 GPU 卡上流畅运行,保持其原始精度(bfloat16),并且运行速度更快,让每个人都可以使用高质量的 AI 模型。

舒适用户界面

我们还精心设计了 ComfyUI 工作流程,使 Flux.1 Lite 的使用更加无缝!在 中找到它comfy/flux.1-lite_workflow.json


safetensors 检查点可在此处找到:flux.1-lite-8B-alpha.safetensors

高频空间

借助TheAwakenOne,您还可以在Flux.1 Lite HF 空间上测试模型

在 Freepik 上尝试一下!

我们的AI 生成器现在由 Flux.1 Lite 提供支持!

新闻

  • 2024 年 10 月 28 日。得益于TheAwakenOne, Flux.1 Lite 8B Alpha HF 空间可在HF Space上使用

  • 2024 年 10 月 23 日。Alpha 8B 检查点在HuggingFace Repo上公开可用。

引文

如果您发现我们的工作有帮助,请引用它!

@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] 非商业许可证。黑森林实验室版权所有。公司

我们的模型权重是根据 FLUX.1 [dev] 非商业许可证发布的。

让我们实测一下看看效果:

1、亚洲脸的女生

提示词:

photo realistic, natural light, white theme, Asian female lady, long hair, pretty face, petite body, pale skin, casual home wear, shy , blush, sexy, Artistic printed T-shirt, short pant, private room, charming, modelling pose, arm over shoulder pose, masterpiece output, top quality, high resolution, looking at viewer, Japan analog film toning, side back lighting,

2、光影

提示词:

Photo realistic, 35mm lens, wide angle view, night street portrait, Asian lady,long hair, pretty face, petite body, sexy, sultry, allure, casual wear, dress, posing at street, street lighting, top quality, masterpiece artwork, vibrant color, high dynamic range, looking at viewer, full body view,

3、抬头的女孩

提示词:

photo of a mysterious girl posing sexy, slender skinny body, with expressive eyes and bold eyeliner, dark make-up, she has sensuous lips, open mouth revealing the tip of her tongue, cheeky expression, medium covered breasts and wears a white dress. long white hair with pink strands, photography masterpiece, modern, irresistible beauty, unusual composition, use of negative space, mysterious, emotional, groundbreaking unrivaled opus with unrivaled details, highly detailed, hyper detailed photography, angle from above,front view, medium close-up seen from below,style by Vytautas Kairiukstis,Bloom light,High Key Lighting . Blurred motion, streaks of light, surreal, dreamy, ghosting effectNone

4、在水边

提示词:

A woman, seen from the back, stands waist-deep in a body of water.

Her dress is a vibrant, saturated yellow, flowing slightly. She is holding a large bouquet of yellow daffodils or similar flowers. The flowers are a rich yellow, and the stems are a darker, olive green.

The water is a deep, moody gray-blue, reflecting the colors of the sky and the dress. The surface of the water has ripples and reflections which create a realistic texture.

A muted grayish-blue wall or large surface is behind her, almost like a backdrop to the scene, with a soft, somewhat uneven, or textured appearance to it, with slight vertical striations. The light seems muted and diffused.

5、夜景

提示词:

A beautiful, dark-haired woman with an impeccably fit physique, dressed in a sleek, black evening gown that hugs her curves, standing in a luxurious penthouse suite. She stands by a floor-to-ceiling window, gazing out over the city lights below, one hand delicately resting on her hip. The dramatic lighting from the city skyline illuminates her figure, casting her as a modern goddess looking down on her domain. Beauty, PhotoRealism, [vivid style, cinematic lighting, nighttime cityscape background],(photorealistic:1.2), 32k, high contrast, intricately detailed eyes), real (skin textures), aidmaimageupgrader, aidmafluxpro1.1

注意事项:

工作流带两个提示词录入框,一个是clip_l,一个是t5xxl,建议都要录入(复制粘贴一下即可)。

下载:

huggingface:

https://huggingface.co/Freepik/flux.1-lite-8B-alpha/tree/main

网盘(含工作流):

https://pan.quark.cn/s/ca86b99af581




路过银河AI
凝视深渊过久,深渊将回以凝视。天空的深渊,便是天渊。
 最新文章