python利用stable-diffusion-webui进行AI画图

官网 https://github.com/AUTOMATIC1111/stable-diffusion-webui

免python版本 https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases/tag/v1.0.0-pre

先把源码,克隆到本地,conda创建一个虚拟环境

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
conda create -n stableDiffusionWebui python=3.10.6 
conda activate stableDiffusionWebui 

下载大模型,可以去https://hf-mirror.com/

然后放到models/Stable-diffusion

默认需要电脑支持gpu,而且代码会下载最新的torch,先去https://pytorch.org/get-started/locally/找到符合自己电脑的torch,再修改源码,找到 prepare_environment方法


双击 web.bat 会自动下载所有依赖,然后浏览器会打开,例如 http://127.0.0.1:7860/

启动参数 --lowvram --theme dark --xformers --precision full --no-half --no-half-vae --api --autolaunch

如果报错

OSError: Can’t load tokenizer for ‘openai/clip-vit-large-patch14’. If you were trying to load it from ‘https://huggingface.co/models’, make sure you don’t have a local directory with the same name. Otherwise, make sure ‘openai/clip-vit-large-patch14’ is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.

方案1:去魔塔或者hf-mirror下载对应的clip-vit-large-patch14,本地创建openai文件夹,把模型文件下载到openai这里。

方案2:pip install --upgrade transformers 反正我是这么做就解决了

最后看我的结果。。。eng。。。电脑太垃圾了,分辨率调成512都会卡死,只能是256

posted @   朝阳1  阅读(101)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示