Stable Diffusion加chilloutmixni真人图片生成模型,AI绘图杀疯了 您所在的位置:网站首页 奖券图片自动生成 Stable Diffusion加chilloutmixni真人图片生成模型,AI绘图杀疯了

Stable Diffusion加chilloutmixni真人图片生成模型,AI绘图杀疯了

2023-03-15 09:02| 来源: 网络整理| 查看: 265

头条号:人工智能研究所 微信号:启示AI科技 视频号:启示科技

上期图文教程,我们分享过AI绘图大模型Stable Diffusion以及中文版本文心AI绘画大模型的基础知识以及代码实现,截至到目前为止。Stable Diffusion模型已经更新到了V2.1版本,其文生图大模型也越来越火,其在2022年底,由AI绘制的图片被荣为国际大奖,让大家对AI绘画大模型也越来越关注,只是被突然杀出来的ChatGPT抢了风头,本期我们基于Stable Diffusion webui开源项目,介绍一下最近大火的Stable Diffusion模型。

Stable Diffusion模型+chilloutmixni

stable-diffusion-webui

Stable Diffusion是一种扩散模型,可以经过训练,使用文本进行图片的生成任务,很多基于Stable Diffusion模型的训练模型已经发布,最近比较火的便是chilloutmixni(一个真人图片生成模型)与lora模型(一种风格模型),2种模型可以搭配使用,由于Stable Diffusion模型开源的是源代码,针对普通非程序员,交互起来,不是很友好,这不,基于Stable Diffusion的UI可视化项目也同步开源,其中最著名的便是如下开源webUI。

https://github.com/AUTOMATIC1111/stable-diffusion-webui# UI开源

stable-diffusion-webui

stable-diffusion-webui项目是基于stable-diffusion开源的可视化界面,我们可以直接在浏览器上面运行stable-diffusion,基于可视化的效果,我们可以很容易的控制各个模型的参数。目前很多基于stable-diffusion-webui项目开发了很多插件,包含汉化插件,controlNet等。

https://github.com/Stability-AI/stablediffusion

安装stable-diffusion-webui,其官方也有很多相关的教程,本期我们就基于Google colab运行环境进行介绍,关键是stable-diffusion需要大量的GPU,其colab有免费的GPU资源可以使用,我们就基于Google colab来安装stable-diffusion-webui。

stable-diffusion-webui安装

stable-diffusion-webui的安装,我们直接使用git指令来复制整个工程

!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git %cd stable-diffusion-webui !git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai

首先我们需要复制整个stable-diffusion-webui工程,然后进入stable-diffusion-webui文件夹中,再复制Stability-AI相关官方代码库,以上2个工程便可以成功运行stable-diffusion-webui程序了。

然后我们安装相关的第三方库

!pip install -r requirements.txt !pip install open_clip_torch !pip install k_diffusion !pip install taming_transformers-rom1504 !pip install fastapi=0.90

首先我们需要安装requirements要求的第三方库,理论上安装requirements要求的库后,真个工程就可以正常运行,但是整体模型运行下来还需要安装如下四个库,且fastapi的版本需要为0.90,然后我们就可以正常运行整个工程了。

!pip install open_clip_torch !pip install k_diffusion !pip install taming_transformers-rom1504 !pip install fastapi=0.90

在运行整个工程之前,由于我们需要使用chilloutmixni真人模型,因此需要下载此模型,在Google colab里面,我们可以使用如下代码来下载chilloutmixni模型。

!curl -Lo chilloutmixni.safetensors https://huggingface.co/nolanaatama/chomni/resolve/main/chomni.safetensors

下载完成的chilloutmixni模型,需要放置到如下文件夹下

stable-diffusion-webui>>models>>stable-diffusion

当然,若有lora模型,需要放置到如下文件夹下

stable-diffusion-webui>>models>>Lora

当模型下载完成后,我们便可以使用如下代码来运行整个工程了,代码会自动安装相关的库以及自动下载相关的模型文件。

!python launch.py --share --xformers --enable-insecure-extension-accessPython 3.9.16 (main, Dec 7 2022, 01:11:51) [GCC 9.4.0] Commit hash: 3531a50080e63197752dd4d9b49f0ac34a758e12 Installing xformers Fetching updates for Stable Diffusion... Checking out commit for Stable Diffusion with hash: 47b6b607fdd31875c9279cd2f4f16b92e4ea958e... Cloning Taming Transformers into repositories/taming-transformers... Cloning K-diffusion into repositories/k-diffusion... Cloning CodeFormer into repositories/CodeFormer... Cloning BLIP into repositories/BLIP... Installing requirements for CodeFormer Installing requirements for Web UI Launching Web UI with arguments: --share --xformers --enable-insecure-extension-access 2023-03-11 10:51:02.869144: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-03-11 10:51:06.507725: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.9/dist-packages/cv2/../../lib64:/usr/lib64-nvidia 2023-03-11 10:51:06.508205: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.9/dist-packages/cv2/../../lib64:/usr/lib64-nvidia 2023-03-11 10:51:06.508233: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly. Calculating sha256 for /content/stable-diffusion-webui/models/Stable-diffusion/chilloutmixni.safetensors: 7234b76e423f010b409268386062a4111c0da6adebdf3a9b1a825937bdf17683 Loading weights [7234b76e42] from /content/stable-diffusion-webui/models/Stable-diffusion/chilloutmixni.safetensors Creating model from config: /content/stable-diffusion-webui/configs/v1-inference.yaml LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Downloading (…)olve/main/vocab.json: 100% 961k/961k [00:00

小编基于GPT-3.5的接口开发了小程序,可以直接在小程序里面输入自己的问题来使用GPT,免费使用。小程序同样集成了AI绘画功能,欢迎体验。

更多transformer模型 VIT模型 swin transformer模型 参考头条号:人工智能研究所


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有