智能

AIGC 实战(环境篇)—— Debian 部署 Flux

波比AI · 5月2日 · 2025年本文共2828个字 · 预计阅读10分钟3次已读

[!quote] 背景

Flux 优势:

• 卓越的视觉质量: 生成具有出色细节和清晰度的图像。
• 精确的提示词遵循: 准确地将文本提示转化为图片,一次生成,无需抽卡。
• 多样化的风格: 支持广泛的艺术风格。
• 复杂场景生成: 创建精细详尽的场景。

在线体验:

[!tip] 官网:https://flux1ai.com/dev modelscope: https://www.modelscope.cn/studios/muse/flux_dev

一、本地部署 CombobyaifyUI

详细教程:[[AIGC 实战(环境篇) – 安装部署 ComfyUI]]

二、下载 Flux 模型

FLUX 模型有四个可选,FLUX.1 [dev] 、FLUX.1 [dev] fp8、FLUX.1 [schnell]、FLUX.1 [schnell] fp8;

  1. FLUX.1 [dev] :官方版本满配版,最低显存要求24G;下载地址: https://huggingface.co/black-forest-labs/FLUX.1-dev/tree/main
  2. FLUX.1 [dev] fp8:大佬优化 [dev] 后版本,建议选择此版本,最低 12G 显存可跑;下载地址: https://huggingface.co/Kijai/flux-fp8/blob/main/flux1-dev-fp8.safetensors
  3. FLUX.1 [schnell]:4步蒸馏模型,大多数显卡可跑。 下载地址: https://hf-mirror.com/black-forest-labs/FLUX.1-schnell/tree/main
  4. FLUX.1 [schnell] fp8:优化 版本,适应更低的显卡配置。下载地址: https://huggingface.co/Kijai/flux-fp8/blob/main/flux1-schnell-fp8.safetensors

这里下载第3种,4步蒸馏模型,大多数显卡可跑。

AIGC 实战(环境篇)—— Debian 部署 Flux

无论下载上面的哪个模型,都存放在这个:ComfyUI/models/unet/ 目录下

AIGC 实战(环境篇)—— Debian 部署 Flux

三、下载 CLIP 模型

点击地址下载CLIP: https://huggingface.co/comfyanonymolaoxiongb2cus/flux_text_encoders/tree/main

下载t5xxl_fp16.safetensors 或 t5xxl_fp8_e4m3fn.safetensors (建议选择fp8 版本,如果你显存超过 32G 可选择 fp16 版本)

AIGC 实战(环境篇)—— Debian 部署 Flux

放入到ComfyUI/models/clip/ 目录中

AIGC 实战(环境篇)—— Debian 部署 Flux

四、下载 VAE 模型

下载地址:https://huggingface.co/black-forest-labs/FLUX.1-schnell/tree/main

解压下载VAE模型

AIGC 实战(环境篇)—— Debian 部署 Flux

下载到本地后,存放至ComfyUI/models/vae/ 目录

AIGC 实战(环境篇)—— Debian 部署 Flux

最后回到 ComfyUI 目录,启动运行脚本

AIGC 实战(环境篇)—— Debian 部署 Flux

重新进入到浏览器当中 http://127.0.0.1:8188

AIGC 实战(环境篇)—— Debian 部署 Flux

五、演示文生图(工作流)

接下来需要调用模型

点击链接:Flux Examples | ComfyUI_examples (comfyanonymous.github.io)

可以看到有Flux Dev版本和Flux Schnell版本,这里和开头一样,我使用的是Flux Schnell版本

AIGC 实战(环境篇)—— Debian 部署 Flux

把图片保存到本地

回到 ComfyUI 当中,把图片直接拖入进去,可以看到自动加载模型

AIGC 实战(环境篇)—— Debian 部署 Flux

在CLIP文本编码器当中,修改提示词(输入翻译后的英文),点击右侧添加提示词队列

如果出现报错,需要把左侧的加载器修改为fp8

AIGC 实战(环境篇)—— Debian 部署 Flux

AIGC 实战(环境篇)—— Debian 部署 Flux

可以看到右侧已经生成了新的图片,我们在本地成功部署了ComfyUI并搭建了 Flux.1 大模型,如果想团队协作多人使用,或者在异地其他设备使用的话就需要结合Cpolar内网穿透实现公网访问,免去了复杂得本地部署过程,只需要一个公网地址直接就可以进入到ComfyUI中来使用 Flux.1文生图。

六、示例

然后,我们把提示词修改一下,让它生成一只卡通猴子~

A catoon monkey with smile holding up a sign with a rainbow in it, reading "AI".

哈哈,尽管并没完全按照指令生成。不过,个人感觉还是挺可爱的,用来做logo、做封面怎么样?

AIGC 实战(环境篇)—— Debian 部署 Flux

再来测试一个封面图,我让它写上 Houge AI

A round chocolate cake decorated with chocolate shavings, topped with the words Houge AI in white icing and garnished with red cherries. The cake is positioned on a white plate on a wooden table, with a coffee cup and saucer in the background.

AIGC 实战(环境篇)—— Debian 部署 Flux

接着,我laoxiongb2c们再从 AI 绘画社区中找一些垂类模型的提示词来实测一下:

1girl,sweater,white background,

简单的提示词,默认是生成卡通类型的图像:

AIGC 实战(环境篇)—— Debian 部署 Flux

再给加点料:

masterpiece,best quality,1girl,moyou,seductive smile,(Turtleneck_sweater_dress:1.5),(Thigh-high_boots:1.4),(Wide-brim_hat:1.3),(Autumn_foliage_background:1.3)

AIGC 实战(环境篇)—— Debian 部署 Flux

生成一张写实类的吧:

official art,Best quality,masterpiece,ultra high res,((photorealistic:1.4)),((deep Focus)),raw photo,extremely delicate,intricate details,best shadow,1girl,upper body,beautiful,cool,smallface,detailed face,((detailed very long hair)),(pale skin),((brown eyes)),deep shadow,look away,film grain,low key,soft lighting,poised poise,dramatic angles,geometric shapes,contrasts of light and shadow,high-tech backdrop,crisp lines

AIGC 实战(环境篇)—— Debian 部署 Flux

别的不说,细节绝对拉满。Asian girl 亚洲脸,能不能行?

AIGC 实战(环境篇)—— Debian 部署 Flux

有一说一,Flux 在细节处理上已经足够逼真,不过写实类的还得是垂类大模型~

官方体验地址,因为 GPU 资源有限,高峰期容易排队失败~

但这是一个开源模型,我们完全可以本地跑起来,接着就带着大家实操一番~

总结

参考

[Total: 0 Average: 0]
0 条回应

必须 注册 为本站用户, 登录 后才可以发表评论!