ICEdit:开源的高效的通过自然语言编辑图像
功能介绍
ICEdit(In-Context Edit) 核心能力是通过自然语言来编辑图像,在该领域编辑效果超越了 OmniGen
,同时在人物一致性保持方面超越了 gpt-4o。通过下图我们可以看到所有的能力。
安装应用
系统要求:需要 GPU 支持,且显存大小需要 14G 以上。(官方介绍:如果使用 ComfyUI-nunchaku,则仅需要 4G 显存即可)
下面以 Windows11 为例,演示安装流程,在 cmd 中依次输入以下命令
shell
cd C:\ai\ICEdit\model
# 下载代码
git clone https://github.com/River-Zhang/ICEdit.git
cd ICEdit
# 创建环境
conda create -n icedit python=3.12
conda activate icedit
# 安装依赖
pip install -r requirements-windows.txt
下载模型
ICEdit 需要两个模型:
其中 Flux.1-fill-dev
需要登录 huggingFace 才能下载,可以使用如下命令下载:(命令中的 token 在 huggingFace 的个人中心可见)
shell
huggingface-cli download --token ${token} --resume-download black-forest-labs/FLUX.1-Fill-dev --local-dir C:\ai\ICEdit\model\flux1-dev-fill
最终的模型放置文件夹结构如下:
text
C:\ai\ICEdit\model
- flux1-dev-fill
- scheduler
- ..
- text_encoder
- ..
- text_encoder_2
- ..
- tokenizer
- ..
- tokenizer_2
- ..
- transformer
- ..
- vae
- ..
- model_index.json
- lora
- ICEdit-normal-LoRA.safetensors
启动应用
在 cmd 中输入以下命令
shell
python scripts/gradio_demo_windows.py --server_name 127.0.0.1 --port 7861 --flux-path model\flux1-dev-fill --lora-path model\lora --enable-model-cpu-offload --int8
启动参数:
- --server_name 和 --port:ip 和端口
- --flux-path:Flux.1-fill-dev 模型所见的文件夹地址
- --lora-path:ICEdit-normal-LoRA.safetensors 模型所在的文件夹地址
- --int8:使用该量化模式,24G 显存可用
- --enable-model-cpu-offload --int8:开启该命令后,可以在 14G 显存的情况下使用,--enable-model-cpu-offload 会显著降低推理速度
在 cmd 中看到如下日志,表示成功
shell
* Running on local URL: http://127.0.0.1:7861
此时浏览器输入 http://127.0.0.1:7860,展示界面如下(界面包含:参数说明/操作区/示例区,以下仅贴出操作区)
图片大小限制:仅支持宽度为512的图片,上传图片会根据宽度进行缩放。
重要参数:
Guidance Scale
: The higher the value, the more similar the generated image will be to the prompt. If the image appears oversaturated, please reduce the scale.Number of inference steps
: 推理步数LoRA Scale
:lora 强度.
文章的最后,如果您觉得本文对您有用,请打赏一杯咖啡!感谢!
