跨境派

跨境派

跨境派,专注跨境行业新闻资讯、跨境电商知识分享!

当前位置:首页 > 综合服务 > 培训机构 > 无需翻墙|Stable Diffusion WebUI 安装|AI绘画

无需翻墙|Stable Diffusion WebUI 安装|AI绘画

时间:2024-04-03 07:30:45 来源:网络cs 作者:言安琪 栏目:培训机构 阅读:

标签: 安装  绘画  无需 

前言

最近终于有机会从围墙里往外看,了解到外面的世界已经有了天翻地覆的变化,感叹万千,笔者在本地mac,windows,linux,docker部署了不下20遍后,整理出来的linux极简避坑安装方案,供大家参考学习。

系统:linux

用户:py

python:3.10

涉及工具:wget、miniconda、git

Stable Diffusion WebUI简称:webui

安装目录:/data/

github地址

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

安装

miniconda

由于stable-diffusion-webui的安装需要特定的python版本,所以使用工具管理python库,且由于Anaconda过于臃肿,所以选择miniconda

# 安装wget工具,确保可以使用下载功能yum install -y wget# 安装minicondawget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh# 执行权限chmod +x Miniconda3-latest-Linux-x86_64.sh# 新建用户 py   ## 由于webui默认不允许root用户执行,且新建用户更好的管理pythonuseradd py# 新建目录/data# 将安装脚本移动到/data,方便管理mv Miniconda3-latest-Linux-x86_64.sh /data/#将data目录授权给pychown -R py:py /data# 安装miniconda# 切换用户su - py    cd /data./Miniconda3-latest-Linux-x86_64.sh##遇到输入写yes,其他按回车,安装完成#安装完成后,默认没有(base)前缀,是环境还未生效,需要手动sourcesource /home/py/.bashrc# 就会发现控制台由[py@localhost ~]$#变成了(base) [py@localhost ~]$# miniconda 安装完成

python 环境

# 使用conda 安装webui需要使用的环境conda create --name sd python=3.10# 使用sd环境,后续操作都在sd环境执行conda activate sd #控制台变为(sd) [py@localhost ~]$# 设置pip的阿里镜像源pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/pip config set install.trusted-host mirrors.aliyun.com

git

# 安装 git ,由于conda 可以安装工具,所以直接使用condaconda install -y git

stable-diffusion-webui

# 下载github源码git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git# 启动cd stable-diffusion-webui./webui.sh############该操作会执行较久的时间,来下载依赖,如遇到github依赖下载失败,多执行几遍,github网站在国内不算限制访问##### 启动以后,如果程序没有发现已存在的模型,则会自动下载模型,该操作访问的是外网,所以需要手动下载模型,放到# 模型所在的位置 /data/stable-diffusion-webui/models/Stable-diffusion/# 这里上传了一个`dreamshaper_8`的模型,供大家在内网使用,见文章最后# 内网启动会遇到如下报错,由于 https://huggingface.co/ 国内访问不了,所以有个依赖下载失败,该资源也提供下载,见文章最后`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.`#下载该资源放到任意路径,本文放置/data/stable-diffusion-webui/下,/huggingface/transformers为资源内部目录#调整报错的脚本# /data/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/encoders/modules.pyopenai/clip-vit-large-patch14替换为/data/stable-diffusion-webui/huggingface/transformers#################################最终启动./webui.sh --skip-torch-cuda-test --no-half --use-cpu interrogate --listen --port 1111#--skip-torch-cuda-test 没有显卡,跳过检查,不然起不来#--no-half 降低精度,减少资源使用,不然起不来#--use-cpu interrogate cpu的使用策略,可选 all#--listen 该参数不加的话,只能本地访问,添加该参数,可以在其他客户端访问#--port 指定端口,默认7860

web页面

默认是英文,本页面是安装了中文插件
https://github.com/VinsonLaro/stable-diffusion-webui-chinese.git

在这里插入图片描述
在这里插入图片描述

简单使用

输入提示词 1girl
在这里插入图片描述
在这里插入图片描述

模型下载地址:https://civitai.com/

dreamshaper_8模型下载|openai/clip-vit-large-patch14资源下载:
由于文件最大只能上传1000M,所以拆分成了多个文件:
dreamshaper_8:
Stable Diffusion WebUI -模型&依赖-001
Stable Diffusion WebUI -模型&依赖-002
Stable Diffusion WebUI -模型&依赖-003
huggingface|clip-vit-large-patch14:
Stable Diffusion WebUI -模型&依赖-004
Stable Diffusion WebUI -模型&依赖-005
Stable Diffusion WebUI -模型&依赖-006
每个小块挂了1个积分,来抵消上传的流量费-_-,没有积分的同学可以私我

本文链接:https://www.kjpai.cn/news/2024-04-03/153035.html,文章来源:网络cs,作者:言安琪,版权归作者所有,如需转载请注明来源和作者,否则将追究法律责任!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。

文章评论