前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >InvokeAI:Stable Diffusion最好的WebUI?

InvokeAI:Stable Diffusion最好的WebUI?

原创
作者头像
点火三周
修改2022-12-04 10:04:45
7.3K0
修改2022-12-04 10:04:45
举报
文章被收录于专栏:AI图像处理AI图像处理

今天,我想向你展示一个我所见过的最好的用于Stable Diffusion的最佳WebUI之一。

它的设置超级简单,使用起来非常直观。这是一个新的WebUI,他们超级专注,他们非常有帮助,顺便说一下,最令人惊讶的是,这是开发在Windows Mac和Linux上运行的,可适用于只有4G内存的GPU的AI图片生成应用。

我现在想告诉你设置这个是多么容易,去这个页面: https://github.com/invoke-ai/InvokeAI,你可以下载invoke AI的安装脚本,在其release页面中(https://github.com/invoke-ai/InvokeAI/releases/tag/v2.2.3)有Linux的mac和Windows的安装脚本:

下载和安装

现在,我们以Linux上的安装为例。首先,下载invokeAI-src-installer-2.2.3-linux.zip。该文件中只是包含了一个install.sh下载脚本和README.md。整个过程比较简单和傻瓜,你只需在网络顺畅的情况下,执行一次install.sh即可。默认安装下来,大概需要20多GB的磁盘空间,其中包括完整的Python、pytorch运行环境,WebUI本身的运行前后端,以及推荐的各种AI模型。

中途唯二的两次需要人工介入的是:

  1. 你需要选择一次模型的安装目录和内容的输出目录,以及一些默认配置,对应的输入会记录在home目录下的.invokeai文件
代码语言:javascript
复制
Loading Python libraries...

Welcome to InvokeAI. This script will help download the Stable Diffusion weight files
and other large models that are needed for text to image generation. At any point you may interrupt
this program and resume later.

** INITIALIZING INVOKEAI RUNTIME DIRECTORY **
Select a directory in which to install InvokeAI's models and configuration files [/home/ubuntu/invokeai]: /apps/invokeAI
Select the default directory for image outputs [/apps/invokeAI/outputs]: /apps/invokeAI/outputs

InvokeAI models and configuration files will be placed into "/apps/invokeAI" and image outputs will be placed into "/apps/invokeAI/outputs".
Accept these locations? [y] y

You may change the chosen directories at any time by editing the --root and --outdir options in "/home/ubuntu/.invokeai",
You may also change the runtime directory by setting the environment variable INVOKEAI_ROOT.

The NSFW (not safe for work) checker blurs out images that potentially contain sexual imagery.
It can be selectively enabled at run time with --nsfw_checker, and disabled with --no-nsfw_checker.
The following option will set whether the checker is enabled by default. Like other options, you can
change this setting later by editing the file /home/ubuntu/.invokeai.
Enable the NSFW checker by default? [y] n

The next choice selects the sampler to use by default. Samplers have different speed/performance
tradeoffs. If you are not sure what to select, accept the default.
Default sampler to use? (ddim, k_dpm_2_a, k_dpm_2, k_euler_a, k_euler, k_heun, k_lms, plms) [k_heun]:

The number of denoising steps affects both the speed and quality of the images generated.
Higher steps often (but not always) increases the quality of the image, but increases image
generation time. This can be changed at run time. Accept the default if you are unsure.
Default number of steps to use during generation? [20]:
Creating the initialization file at "/home/ubuntu/.invokeai".

2. 你需要在你的huggingface账户上同意相关的license协议,并提供hugging face的token,以便下载

代码语言:javascript
复制
Welcome to InvokeAI. This script will help download the Stable Diffusion weight files
and other large models that are needed for text to image generation. At any point you may interrupt
this program and resume later.

** DOWNLOADING DIFFUSION WEIGHTS **
You can download and configure the weights files manually or let this
script do it for you. Manual installation is described at:

https://github.com/invoke-ai/InvokeAI/blob/main/docs/installation/INSTALLING_MODELS.md

You may download the recommended models (about 10GB total), select a customized set, or
completely skip this step.

Download <r>ecommended models, <a>ll models, <c>ustomized list, or <s>kip this step? [r]: 
** LICENSE AGREEMENT FOR WEIGHT FILES **

To download the Stable Diffusion weight files from the official Hugging Face 
repository, you need to read and accept the CreativeML Responsible AI license.

This involves a few easy steps.

1. If you have not already done so, create an account on Hugging Face's web site
   using the "Sign Up" button:

   https://huggingface.co/join

   You will need to verify your email address as part of the HuggingFace
   registration process.

2. Log into your Hugging Face account:

    https://huggingface.co/login

3. Accept the license terms located here:

   https://huggingface.co/runwayml/stable-diffusion-v1-5

   and here:

   https://huggingface.co/runwayml/stable-diffusion-inpainting

    (Yes, you have to accept two slightly different license agreements)

Press <enter> when you are ready to continue:
(Fetching Hugging Face token from cache...not found

4. Thank you! The last step is to enter your HuggingFace access token so that
   this script is authorized to initiate the download. Go to the access tokens
   page of your Hugging Face account and create a token by clicking the 
   "New token" button:

   https://huggingface.co/settings/tokens

   (You can enter anything you like in the token creation field marked "Name". 
   "Role" should be "read").

   Now copy the token to your clipboard and paste it at the prompt. Windows
   users can paste with right-click.
   Token: 
Password: *************************************

** DOWNLOADING WEIGHTS **
* v1-5-pruned-emaonly.ckpt: Downloading...

这里建议的方式是在AWS或GCP上临时购置一台主机,因为按照默认配置,整个软件安装需要下来的软件非常多,很多都是需要从github和huggingface上直接下载的,而国内云厂商的网络的下行流量普遍偏慢,而上行带宽却是足够的。

需要注意的是,如果我们采用国外打包上传的方式,需要打包的目录包括

  • invokeAI的安装目录
  • home目录下的.cache目录(主要是~/.cache/torch/hub/checkpoints/checkpoint_liberty_with_aug.pth文件,也可以自己在腾讯云上下载,稍慢些,需要几分钟)

我个人的实践是,在GCP上完成linux环境的下载,大概需要20分钟左右,打包之后,将20多GB的压缩包从GCP发送到腾讯云,也只需要30多分钟。这比在腾讯云上直接下来要快多了。

服务器选择

可能你会好奇,我为什么会选择腾讯云?主要的原因是用于AI绘画的服务器,如果想有好的体验,是必须要有足够的计算资源的。除非自己日常用的电脑足够强劲,否则在体验阶段,我建议选择云,特别是腾讯云。

因为腾讯云的免费体验馆上,有目前我能看到的最优惠的机型:

1月免费体验15天,99元体验30天。而同样的配置,我在阿里云上看,一个月最低只能打4折,还是需要2000多元。

运行体验

只需要进到你解压之后的InvokeAI的目录,执行invoke.sh即可运行:

代码语言:javascript
复制
ubuntu@VM-0-6-ubuntu:/apps/invokeAI$ ./invoke.sh 
Do you want to generate images using the
1. command-line
2. browser-based UI
3. open the developer console
Please enter 1, 2, or 3: 2

Starting the InvokeAI browser-based UI..
* Initializing, be patient...
>> Initialization file /home/ubuntu/.invokeai found. Loading...
>> InvokeAI runtime directory is "/apps/invokeAI"
>> patchmatch.patch_match: INFO - Compiling and loading c extensions from "/apps/invokeAI/src/pypatchmatch/patchmatch".
>> patchmatch.patch_match: WARNING - patchmatch failed to load or compile.
>> patchmatch.patch_match: WARNING - Refer to https://github.com/invoke-ai/InvokeAI/blob/main/docs/installation/INSTALL_PATCHMATCH.md for installation instructions.
>> Patchmatch not loaded (nonfatal)
>> GFPGAN Initialized
>> CodeFormer Initialized
>> ESRGAN Initialized
>> Using device_type cuda
>> Current VRAM usage:  0.00G
>> Scanning Model: stable-diffusion-1.5
>> Model Scanned. OK!!
>> Loading stable-diffusion-1.5 from /apps/invokeAI/models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt
   | LatentDiffusion: Running in eps-prediction mode
   | DiffusionWrapper has 859.52 M params.
   | Making attention of type 'vanilla' with 512 in_channels
   | Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
   | Making attention of type 'vanilla' with 512 in_channels
   | Using faster float16 precision
   | Loading VAE weights from: /apps/invokeAI/models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt
>> Model loaded in 61.56s
>> Max VRAM used to load the model: 2.17G 
>> Current VRAM usage:2.17G
>> Current embedding manager terms: *
>> Setting Sampler to k_heun

* --web was specified, starting web server...
>> Initialization file /home/ubuntu/.invokeai found. Loading...
>> Started Invoke AI Web Server!
>> Default host address now 127.0.0.1 (localhost). Use --host 0.0.0.0 to bind any address.
>> Point your browser at http://127.0.0.1:9090

其运行界面如下:

特点

现在,令人惊奇的部分来了,他们在WebUI中建立了很多功能,所以我想在左边向你展示,你有一个文本到图像的模式,非常直观地使用,你有一个图像到图像的模式,也非常实用。但这些功能,如果你习惯使用了automatic 1111的stable-diffusion-webui,这部分可能不会让你觉得惊艳。

其实,让我决定尝试InvokeAI的理由,主要是它提供了一个比DreamStudio更好的画布功能,你可以在这里进行绘画,这是我见过的最好的绘画工具,所以你可以得到疯狂的好结果。

一句话总结,就是它可以在画布上对已有的作品,进行任意延展的创意设计。

比如,下面的这幅数字作品:

我可以在画布中,将其右上角扩展出一个同样风格的区域,并可以加入其他的元素:

他们还将增加一个节点模式,你可以连接不同的节点来生成你的图像,我甚至无法想象这将是多么神奇。

他们将有一个后期处理模式,所以这将是令人震惊的

他们还想在这里提供textual inversion和Dreambooth的培训:

但这些功能还得耐心等待更新

总结

随着这个市场越来越火热,社区中涌现出来越来越多的工具试图减少AI绘图的入门成本和缩短上手路径。只有当AI绘图能够真正的普惠到普罗大众,只需要基础的绘画知识和创意,而不需要机器学习的专业时,这个行业就能真正的成为一个创新的朝阳行业,而不只是一个讲故事,割韭菜,昙花一现的概念

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 下载和安装
  • 服务器选择
  • 运行体验
  • 特点
  • 总结
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档