Skip to content

安装和使用自定义脚本

To install custom scripts, place them into the scripts directory and click the Reload custom script button at the bottom in the settings tab. Custom scripts will appear in the lower-left dropdown menu on the txt2img and img2img tabs after being installed. Below are some notable custom scripts created by Web UI users:

txt2img2img

https://github.com/ThereforeGames/txt2img2img

大大提高任何角色/主题的可编辑性,同时保留其相似性。此脚本的主要动机是提高通过文本反转创建的嵌入的可编辑性。

(小心克隆,因为它有一点venv检查)

示例:

txt2mask

https://github.com/ThereforeGames/txt2mask

允许您指定带有文本的绘画遮罩,而不是画笔。

示例:

面具绘图用户界面

https://github.com/dfaker/stable-diffusion-webui-cv2-external-masking-script

提供由CV2提供支持的本地弹出窗口,允许在处理前添加掩码。

示例:

Img2img视频

https://github.com/memes-forever/Stable-diffusion-webui-video

使用img2img,一个接一个地生成图片。

高级种子混合

https://github.com/amotile/stable-diffusion-backend/tree/master/src/process/implementations/automatic1111_scripts

此脚本允许您将初始噪声基于多个加权种子。

前任seed1:2, seed2:1, seed3:1

权重是归一化的,因此您可以像上面一样使用更大的一次,或者您可以做浮点数:

前任seed1:0.5, seed2:0.25, seed3:0.25

及时混合

https://github.com/amotile/stable-diffusion-backend/tree/master/src/process/implementations/automatic1111_scripts

此脚本允许您在生成图像之前通过数学组合它们的文本嵌入来将多个加权提示组合在一起。

前任

Crystal containing elemental {fire|ice}

它支持嵌套定义,因此您也可以这样做:

Crystal containing elemental {{fire:5|ice}|earth}

漫画制作者

https://github.com/Animator-Anon/Animator

一个基本的img2img脚本,将转储帧并构建视频文件。适合在翘曲电影中创建有趣的缩放,但目前没有太多其他内容。

参数音序器

https://github.com/rewbs/sd-parseq

生成对许多Stable Diffusion 参数(如种子、比例、提示权重、去噪强度......)以及输入处理参数(如缩放、平移、3D旋转......)具有严格控制和灵活插值的视频

备用噪音时间表

https://gist.github.com/dfaker/f88aa62e3a14b559fe4e5f6b345db664

为采样器的sigma计划使用备用生成器。

允许从 crowsonkb/k-diffusion 访问 Karras、Exponential 和 Variance Preserving 时间表及其参数。

Vid2Vid

https://github.com/Filarius/stable-diffusion-webui/blob/master/scripts/vid2vid.py

从真实视频中,img2img帧并将它们缝合在一起。不将帧解压到硬盘驱动器。

Txt2VectorGraphics

https://github.com/GeorgLegato/Txt2Vectorgraphics

从提示中创建自定义、可缩放的图标,如SVG或PDF。

示例:

prompt PNG SVG
Happy Einstein
Mountainbike Downhill
coffe mug in shape of a heart
Headphones

循环和叠加

https://github.com/DiceOwl/StableDiffusionStuff

https://github.com/DiceOwl/StableDiffusionStuff/blob/main/loopback_superimpose.py

在强度alpha下将img2img的输出与原始输入图像混合。结果再次输入img2img(在循环>=2),此过程重复。倾向于锐化图像,提高一致性,减少创造力并减少精细细节。

插值

https://github.com/DiceOwl/StableDiffusionStuff

https://github.com/DiceOwl/StableDiffusionStuff/blob/main/interpolate.py

一个img2img脚本,用于生成中间图像。允许两个输入图像进行插值。readme中显示的更多功能。

运行n次

https://gist.github.com/camenduru/9ec5f8141db9902e375967e93250860f

用随机种子运行n次。

高级循环

https://github.com/Extraltodeus/advanced-loopback-for-sd-webui

动态缩放环回,参数变化,并在其他功能中提示切换!

提示形态

https://github.com/feffy380/prompt-morph

生成具有Stable Diffusion 的变形序列。在两个或多个提示之间进行插值,并在每一步创建一个图像。

使用新的AND关键字,可以选择将序列导出为视频。

及时插值

https://github.com/EugeoSynthesisThirtyTwo/prompt-interpolation-script-for-sd-webui

使用此脚本,您可以在两个提示之间进行插值(使用“AND”关键字),生成任意数量的图像。您还可以生成带有结果的GIF。适用于txt2img和img2img。

示例:

动图

不对称瓷砖

https://github.com/tjm35/asymmetric-tiling-sd-webui/

独立控制水平/垂直无缝平铺。

示例:

力对称

https://gist.github.com/missionfloyd/69e5a5264ad09ccaab52355b45e7c08f

请参阅https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/2441

每n个步骤将对称性应用于图像,并将结果进一步发送到img2img。

示例:

txt2调色板

https://github.com/1ort/txt2palette

通过文本描述生成调色板。此脚本将生成的图像转换为调色板。

示例:

XYZ情节脚本

https://github.com/xrpgame/xyz_plot_script

生成一个.html文件以交互式浏览图像集。使用滚轮或箭头键在Z维度中移动。

示例:

扩展-XY电网

https://github.com/0xALIVEBEEF/Expanded-XY-grid

AUTOMATIC1111的Stable Diffusion webui的自定义脚本,为标准xy网格添加了更多功能:

  • 多工具:允许在一个轴上多个参数,理论上允许在一个xy网格中调整无限参数

  • 可定制的提示矩阵

  • 在目录中对文件进行分组

  • S/R占位符-将占位符值(参数列表中的第一个值)替换为所需的值。

  • 将PNGinfo添加到网格图像中

示例:

示例图像:提示:“darth vader骑自行车,修饰符”;X:多功能工具:“提示S/R:自行车,摩托车|CFG比例:7.5,10|提示S/R占位符:修饰符,4k,artstation”;Y:多功能工具:“采样器:欧拉,欧拉a|步骤:20,50”

嵌入到PNG

https://github.com/dfaker/embedding-to-png-script

将现有嵌入转换为可共享图像版本。

示例:

Alpha帆布

https://github.com/TKoestlerx/sdexperiments

画出一个区域。无限外绘概念,使用AUTOMATIC1111 repo中的两个现有外绘脚本作为基础。

示例:

随机网格

https://github.com/lilly1987/AI-WEBUI-scripts-Random

随机输入xy网格值。

示例:

基本逻辑与x/y图相同,仅在内部,x类型固定为步骤,y类型固定为cfg。在步骤1|2值(10-30)范围内生成与步数(10-30)的步骤计数数(10)的x值与cfg计数(10)在cfg1|2值(6-15)范围内的cfg计数(10)的次数一样多)即使您将1|2范围上限倒置,它也会自动更改它。在cfg值的情况下,它被视为int类型,并且不读取十进制值。

随机

https://github.com/lilly1987/AI-WEBUI-scripts-Random

在没有网格的情况下重复简单次数。

示例:

稳定的扩散美学记分器

https://github.com/grexzen/SD-Chad

评价你的图像。

img2tiles

https://github.com/arcanite24/img2tiles

从基础图像生成瓷砖。基于SD高档脚本。

示例:

img2mosiac

https://github.com/1ort/img2mosaic

从图像中生成马赛克。脚本将图像切割成图块,并分别处理每个图块。每块瓷砖的大小是随机选择的。

示例:

测试我的提示

https://github.com/Extraltodeus/test_my_prompt

您是否曾经使用过一个非常长的充满单词的提示,而您不确定这些单词是否对您的形象有任何实际影响?您是否没有勇气尝试逐一删除它们,以测试它们的效果是否配得上您谨慎的GPU?

好吧,现在你不需要任何勇气,因为这个剧本是为你制作的!

它生成的图像与提示符中的单词一样多(当然,您可以选择分隔符)。

示例:

这里的提示很简单:“香蕉,着火,下雪”,因此,正如您所看到的,它生成了每张图像,其中没有每个描述。

你也可以测试你的阴性提示。

像素艺术

https://github.com/C10udburst/stable-diffusion-webui-scripts

简单的脚本可变调整图像大小,还将图像转换为使用给定大小的调色板。

示例:

残疾 启用x8,没有调整大小,没有调色板 启用x8,无调色板 启用x8,16调色板
预览 预览 预览 预览

使用的模型

japanese pagoda with blossoming cherry trees, full body game asset, in pixelsprite style
Steps: 20, Sampler: DDIM, CFG scale: 7, Seed: 4288895889, Size: 512x512, Model hash: 916ea38c, Batch size: 4

FartyPants的剧本

https://github.com/FartyPants/sd_web_ui_scripts

幻觉

  • 交换负和正提示

消极先生

  • 更高级的脚本,根据消极的愤怒先生交换负面和积极的代币

gif2gif

https://github.com/LonicaMewinsky/gif2gif

此脚本的目的是接受动画GIF作为输入,像img2img通常那样处理帧,并将它们重新组合成动画GIF。不打算具有广泛的功能。来自promts_from_file的引用代码。

面部恢复后

https://github.com/butaixianran/Stable-Diffusion-Webui-Post-Face-Restore-Again

从额外选项卡中一次运行两次面部恢复。

无限缩放

https://github.com/coolzilj/infinite-zoom

使用outpainting生成放大/缩小视频,作为img2img选项卡中绘制模式的自定义脚本。

ImageReward记分器

https://github.com/THUDM/ImageReward#integration-into-stable-diffusion-web-ui

基于ImageReward的图像评分器,ImageReward是第一个通用文本到图像人类偏好RM,在总共137k对专家比较方面进行了培训。

迄今为止开发的功能(2023-04-24)包括:(点击展开演示视频)

1.为生成的图像评分并附加到图像信息中 分数和附加到信息.mp4 2.自动过滤掉分数低的图像 带有低分数的过滤图像.mp4

有关详细信息,包括安装特定于功能的用法,请查看脚本介绍

采样过程的保存步骤

(示例脚本)
此脚本将把采样过程的步骤保存到目录中。

import os.path

import modules.scripts as scripts
import gradio as gr

from modules import shared, sd_samplers_common
from modules.processing import Processed, process_images

class Script(scripts.Script):
    def title(self):
        return "Save steps of the sampling process to files"

    def ui(self, is_img2img):
        path = gr.Textbox(label="Save images to path", placeholder="Enter folder path here. Defaults to webui's root folder")
        return [path]

    def run(self, p, path):
        if not os.path.exists(path):
            os.makedirs(path)
        index = [0]

        def store_latent(x):
            image = shared.state.current_image = sd_samplers_common.sample_to_image(x)
            image.save(os.path.join(path, f"sample-{index[0]:05}.png"))
            index[0] += 1
            fun(x)

        fun = sd_samplers_common.store_latent
        sd_samplers_common.store_latent = store_latent

        try:
            proc = process_images(p)
        finally:
            sd_samplers_common.store_latent = fun

        return Processed(p, proc.images, p.seed, "")

我们一直在努力

apachecn/AiLearning

【布客】中文翻译组