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.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?