Auto1111SDK

其他资源 2025-08-15

自动1111 SDK:稳定的扩散Python库

Auto 1111 SDK是一个轻巧的Python库,用于使用稳定的扩散产生图像,升级图像和使用扩散模型编辑图像。它被设计为一个模块化的,轻量级的Python客户端,它封装了[自动1111稳定扩散Web UI](https://gith**u*b.com/automatic1111/stable-diffusion-webui)的所有主要功能。 Auto 1111 SDK当前提供3个主要核心功能:
  • 文本对图像,图像到图像,介入和支出管道。我们的管道支持与稳定的扩散Web UI完全相同的参数,因此您可以轻松地从SDK上的Web UI复制创建。
  • 可以在几行代码中对任何ESRGAN或REAL ESRGAN UPSCALER进行推理的升级管道。
  • 与CIVIT AI集成,直接从网站下载模型。

加入我们的不和谐!!

演示

我们有一个COLAB演示,您可以在其中运行Auto 1111 SDK的许多操作。在这里检查一下!

安装

我们建议在PYPI的虚拟环境中安装Auto 1111 SDK。目前,我们还不支持Conda环境。

pip3 install Auto1111SDK

要安装最新版本的Auto 1111 SDK(现在包括ControlNet),请运行:

pip3 install git+https://gith*u*b.co*m/saketh12/Auto1111SDK.git

Quickstart

使用自动1111 SDK生成图像非常容易。为了推断文本对图像,图像对图像,介入,支出或稳定的扩散高档,我们有1个可以支持所有这些操作的管道。这样可以节省很多RAM,从必须使用其他解决方案创建多个管道对象。

Auto1111SDK import StableDiffusionPipeline pipe = StableDiffusionPipeline("") prompt = "a picture of a brown dog" output = pipe.generate_txt2img(prompt = prompt, height = 1024, width = 768, steps = 10) output[0].save("image.png")">
 from Auto1111SDK import StableDiffusionPipeline

pipe = StableDiffusionPipeline ( "" )

prompt = "a picture of a brown dog"
output = pipe . generate_txt2img ( prompt = prompt , height = 1024 , width = 768 , steps = 10 )

output [ 0 ]. save ( "image.png" )

控制网

目前,ControlNet仅与FP32一起使用。我们很快就会增加对FP16的支持。

Auto1111SDK import StableDiffusionPipeline from Auto1111SDK import ControlNetModel model = ControlNetModel(model="", image="") pipe = StableDiffusionPipeline("", controlnet=model) prompt = "a picture of a brown dog" output = pipe.generate_txt2img(prompt = prompt, height = 1024, width = 768, steps = 10) output[0].save("image.png")">
 from Auto1111SDK import StableDiffusionPipeline
from Auto1111SDK import ControlNetModel

model = ControlNetModel ( model = "" , 
                   image = "" )

pipe = StableDiffusionPipeline ( "" , controlnet = model )

prompt = "a picture of a brown dog"
output = pipe . generate_txt2img ( prompt = prompt , height = 1024 , width = 768 , steps = 10 )

output [ 0 ]. save ( "image.png" )

在Windows上运行

在这里找到说明。由Marco Guardigli贡献,mgua@tomware.it

文档

我们有更多详细的示例/文档,有关如何在此处使用Auto 1111 SDK。有关我们与拥抱面扩散器之间的详细比较,您可以阅读此内容。

有关如何使用SDXL的详细指南,我们建议阅读此信息

特征

  • 原始TXT2IMG和IMG2IMG模式
  • 真正的Esrgan Upscale和Esrgan高档(与任何PTH文件兼容)
  • 支出
  • 插图
  • 稳定的扩散高档
  • 注意,指定文本的一部分,该模型应更加关注
    • A((Tuxedo))中的一个男人 - 将更多地关注燕尾服
    • A(Tuxedo:1.21)中的男人 - 替代语法
    • 选择文本,然后按Ctrl+up或ctrl+down(或命令+up up command+down(如果您使用MacOS))自动调整对所选文本的注意(由匿名用户贡献的代码)
  • 可组合扩散:一次使用多个提示的方法
    • 使用大写和
    • 还支持提示的重量:猫:1.2和狗和企鹅:2.2
  • 与各种采样器一起使用
  • 直接从Civit AI和Realesrgan检查点下载型号
  • 设置自定义VAE:适用于包括SDXL在内的任何型号
  • 用稳定扩散XL管道支持SDXL
  • 将自定义参数传递给模型
  • No 77提示令牌限制(与HuggingFace扩散器不同,具有此限制)

路线图

  • 添加支持雇用修复程序和炼油厂参数以进行推理。
  • 增加对洛拉的支持
  • 增加对面部修复的支持
  • 增加对Dreambooth培训脚本的支持。
  • 增加对ControlNet等自定义扩展的支持。

我们将很快为这些功能提供支持。我们还接受在这些问题上工作的任何贡献!

贡献

Auto1111 SDK正在不断发展,我们感谢社区参与。我们欢迎所有形式的贡献 - 错误报告,功能请求和代码贡献。

通过在GitHub上打开问题来报告错误和请求功能。通过求解/克隆存储库并通过更改提交拉动请求来为该项目做出贡献。

学分

借用代码的许可可以在设置 - >许可屏幕以及HTML/LICENSS.HTML文件中找到。

  • 自动1111稳定扩散Web UI-https://github.com/automatic1111111111111111111111111111111111111111111111111111111111期
  • 稳定扩散-https://github.com/stability-ai/stablediffusion,https://github.com/compvis/taming-transformers
  • k-diffusion-https://github.com/crowsonkb/k-diffusion.git
  • Esrgan -https://github.com/xinntao/esrgan
  • MIDAS -https://github.com/isl-org/midas
  • 优化想法-https://github.com/basujindal/stable-diffusion
  • 交叉注意力层优化-DoggetTX -https://github.com/doggettx/stable-diffusion,及时编辑的原始想法。
  • 跨注意层优化-LSTEIN -INDOKEAI -https://github.com/invoke-ai/invokeai(最初是http://**githu*b.com/lstein/lstein/stable-diffusion)
  • 亚第三次跨注意层优化 - Alex Birch(桦木/扩散器#1),Amin Rezaei(https://g*ithub*.*com/aminrezaeii0x443/memory-memory-efficity-efficienth)
  • 文本反转-Rinon gal -https://github.com/rinongal/textual_inversion(我们不使用他的代码,但我们正在使用他的想法)。
  • SD高档的想法-https://github.com/jquesnelle/txt2imghd
  • 支出MK2-https://github.com/parlance-zz/g-diffuser-bot产生噪声
  • 剪辑询问器的想法并借用一些代码-https://github.com/pharmapsychotic/clip-interrogator
  • 合并扩散的想法-https://github.com/Energy-composital/compositional-visual-generation-with-composable-diffusion-models-pytorch-pytorch
  • Xformers -https://github.com/facebookresearch/xformers
  • float32中的采样精度从float16 unet-marunine-marunine用于示例扩散器实现(https://g*ithub*.co*m/birch-san/diffusers-play/92feee6)
下载源码

通过命令行克隆项目:

git clone https://github.com/Auto1111SDK/Auto1111SDK.git