探索AI绘画技术:使用Stable Diffusion WebUI插件

释放双眼,带上耳机,听听看~!
本文介绍了使用Stable Diffusion WebUI插件进行AI绘画的技术方法,包括模型选择、插件使用方式、效果展示等,适合对AI绘画技术感兴趣的程序员阅读学习。

AI绘画

AI绘画已经火了三四个月了吧,对于程序员这个群体,其实很多人都想尝试,我也看到了不少的关于AI绘画的文章,其中关于Stable Diffusion WebUI的居多。大致上分几类:

  1. 使用,比如文生图、图生图,以及更高深的ControlNet的使用;
  2. 训练,大多是关于Lora的训练,Lora属于小模型;
  3. 白嫖,大多是在没有显卡的情况下,白嫖阿里云、Kaggle、Google Colab等云服务商的显卡;

我也给自己研读的文章分了下类,大致是下面的这些。

使用

  1. 神奇魔法师在哪里?
  2. 神奇魔法在哪里?
  3. 你会选择哪个模型?
  4. AI绘画:你选择对模型了么?
  5. AI绘画参数指北「1」
  6. github.com/SoftMeng/st…

    有兴趣的小伙伴可以给点个赞。

    我编写的 stable-diffusion-prompt-pai 插件

    插件大致是这个样子的,目的是用来生成AI绘画的Prompt。

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    插件使用了阿里巴巴开源的Prompt大模型,其中核心代码有两部分。

    大模型的使用

    我选择了阿里巴巴的 alibaba-pai/pai-bloom-1b1-text2prompt-sd 模型。

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    模型的使用方式比较简单,使用 AutoModelForCausalLM 加载模型,这个模型会自动从网上下载。

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    构造 gradio UI

    用 gradio 画UI是比较简单的,按照官方文档很容易就能学会。

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    文档地址是: gradio.app/docs/

    文档写得很好,细致,而且可以在线尝试,让我感受到了程序世界的美好。

    插件使用效果

    在 Start of the prompt 中填写一些文本,然后点击生成即可。模型会按照文本进行扩展,形成不同的Prompt。

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    • 输入: 1girl with glass and crystal
    • 输出: 如下
    1. digital art of a white haired girl made of glass and crystals and crystalline glass, intricate, elegant, highly detailed, artstation, concept art
    2. A stunning digital painting of girl standing, face made of red glowing shards of glass that are breaking down in thousands at speed, and white crystals in the shape of flowers floating above, symmetrical composition
    3. a portrait of one girl surrounded by crystals and wearing mirrors, in the style of artgerm, macro head shot is on a blur
    4. 1 girl with golden hair, standing close watching a dark glass and crystals in her hands, painting by Greg Rutkowski
    5. one girl is on an island made from glass and crystals, 3 d, artstation 4 k, octane render

    Prompt生成图片的效果

    我们随便用其中的几个参数进行图片的生成。

    第一条Prompt

    digital art of a white haired girl made of glass and crystals and crystalline glass, intricate, elegant, highly detailed, artstation, concept art
    百度翻译一下: 由玻璃、水晶和水晶玻璃制成的白发女孩的数字艺术,复杂、优雅、高度细致、艺术化、概念艺术。

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    第二条Prompt

    A stunning digital painting of girl standing, face made of red glowing shards of glass that are breaking down in thousands at speed, and white crystals in the shape of flowers floating above, symmetrical composition
    百度翻译一下:一幅令人惊叹的数字画,女孩站着,脸是由红色发光的玻璃碎片制成的,这些玻璃碎片正在以极快的速度分解成数千块,上面漂浮着花朵形状的白色晶体,构图对称

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    第三条Prompt

    a portrait of one girl surrounded by crystals and wearing mirrors, in the style of artgerm, macro head shot is on a blur
    百度翻译一下: 一个女孩的肖像被水晶包围,戴着镜子,以艺术细菌的风格,微距头部拍摄是模糊的。

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    探索AI绘画技术:使用Stable Diffusion WebUI插件

    总结

    本次Stable Diffusion WebUI的插件Prompt PAI编写还是很顺利的,耗时大概一上午。同时GET了2门AI基础技能的使用。

    1. 大模型的使用。
    2. Gradio的编程。

    有兴趣的小伙伴可以尝试下,毕竟抱脸上有太多的开源模型等我们享用呢。

    与君共勉。

本网站的内容主要来自互联网上的各种资源,仅供参考和信息分享之用,不代表本网站拥有相关版权或知识产权。如您认为内容侵犯您的权益,请联系我们,我们将尽快采取行动,包括删除或更正。
AI教程

深度学习系列之扩散模型原理代码实践:噪声采样

2023-12-20 16:50:14

AI教程

Lamini:构建ChatGPT超能力的新工具

2023-12-20 17:01:14

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索