https://github.com/timothybrooks/instruct-pix2pix
InstructPix2Pix 的 PyTorch 实现是一种基于指令的图像编辑模型,基于原始 CompVis/stable_diffusion 存储库。
快速入门
按照以下说明下载 InstructPix2Pix 并在您自己的图像上运行。这些指令已在具有 > 18GB VRAM 的 GPU 上进行了测试。如果您没有 GPU,您可能需要更改默认配置,或查看使用模型的其他方式。
设置conda环境,并下载预训练模型:
conda env create -f environment.yaml
conda activate ip2p
bash scripts/download_checkpoints.sh
编辑单个图像:
python edit_cli.py --input imgs/example.jpg --output imgs/output.jpg --edit "turn him into a cyborg"
# Optionally, you can specify parameters to tune your result:
# python edit_cli.py --steps 100 --resolution 512 --seed 1371 --cfg-text 7.5 --cfg-image 1.2 --input imgs/example.jpg --output imgs/output.jpg --edit "turn him into a cyborg"
或者启动您自己的交互式编辑 Gradio 应用程序:
python edit_app.py
设置
安装所有依赖项:
conda env create -f environment.yaml
通过运行以下命令下载预训练模型:
bash scripts/download_checkpoints.sh
作者:Jeebiz 创建时间:2023-12-12 12:24
最后编辑:Jeebiz 更新时间:2025-05-12 09:20
最后编辑:Jeebiz 更新时间:2025-05-12 09:20