当前位置:首页 >> 中药方剂 >> 一份保姆级的Stable Diffusion部署简明,开启你的炼丹之路

一份保姆级的Stable Diffusion部署简明,开启你的炼丹之路

发布时间:2024-02-07

tallers/cuda-repo-ubuntu2004-11-6-local_11.6.2-510.47.03-1_amd64.debsudo dpkg -i cuda-repo-ubuntu2004-11-6-local_11.6.2-510.47.03-1_amd64.debsudo apt-key add /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pubsudo apt-get updatesudo apt-get -y install cuda2.3 装上Python 3.10

Stable Diffusion WebUI目前最低支持Python 3.10,所以从外部装上3.10原版,装上指示:

apt install software-properties-common add-apt-repository ppa:deadsnakes/ppa apt update apt install Python3.10 python3.10 ----verison

PIP另设欧美源,由于默认源在国外,所以装上可能常常不会显现timeout等疑问,常用欧美源可以很大往往避免流媒体包timeout的原因。将如下内容复制到元数据~/.pIP/pip.conf之外都,如从未该元数据,必先创建者touch ~/.pip/pip.conf。

[global] index-url = [install] trusted-host = 2.4 装上Anaconda

相当中选常用Anaconda。Anaconda可以有灵活性受益包且对包能够来进行管理,同时对Python生存环境可以独立管理的发行原版。装上指示也很有趣:

wget linux-x86_64.sh bash ./Anaconda3-2023.03-1-Linux-x86_64.sh

创建者Python3.10.9生存环境,并常用该生存环境

conda create -n python3.10.9 python==3.10.9 conda activate python3.10.92.5 装上PyTorch

首必先在PyTorch部落格查阅相异CUDA原版的Torch,如上述各集2.2中都CUDA 11.6能够装上pytorch1.13.1

# 常用conda装上,两种装上方式二选一conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia# 常用pip装上,两种装上方式二选一pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 ----extra-index-url 三、协同作战Stable Diffusion WebUI3.1 流媒体stable-diffusion-webui

肯定首必先应答Python3.10生存环境:

conda activate python3.10.9

然后流媒体stable-diffusion-webui

git clone github.com/AUTOMATIC1111/stable-diffusion-webui.git3.2 装上依赖

cd到stable-diffusion-webui编目装上相应的依赖,如有到访网络加班、败北等,肯定按照各集2.3中都另设欧美源,如果必先次败北,重试几次一般都可来进行时装上。

cd stable-diffusion-webuipip install -r requirements_versions.txtpip install -r requirements.txt3.3 启进stable-diffusion-webui

装上来进行时后,执行者如下启进指示:

python launch.py ----listen ----enable-insecure-extension-access

这一步骤不会流媒体一些都用三维,如果遇到流媒体败北,根据报错高亮在huggingface.co流媒体三维放入相异编目,如流媒体stable-diffusion-v1-5三维,抓取寻找

浏览图中都流媒体按钮,流媒体v1-5-pruned-emaonly.safetensors到stable-diffusion-webui/models/Stable-diffusion编目,其他三维理应。三维流媒体来进行时,必先次执行者启进指示,高亮已启进到7860适配器,则可以通过IP+7860适配器到访:

公网表示同意另设到访破解,肯定替换下面指示之外都的username:password为用户名、破解。

python launch.py ----listen ----enable-insecure-extension-access ----gradio-auth username:password

上述指示非前台列车运行,如需前台列车运行可以常用nohup、tmux等方法实现。

3.4 常用stable-diffusions生成图片

流媒体一个三维到/stable-diffusion-webui/models/Stable-diffusion编目,三维可以在URL,如下图所用majicMIX realistic三维。流媒体来进行时后浏览左上角刷新按钮,然后并不需要刚流媒体的三维,可用Promot和数值均可生成图片。

附上图所用Promot和数值Prompt

1 girl a 24 y o woman, blonde, dark theme, soothing tones, muted colors, high contrast, look at at viewer, contrasty , vibrant , intense, stunning, captured in the late afternoon sunlight, using a Canon EOS R6 and a 16-35mm to capture every detail and angle, with emphasis on the lighting and shadows, late afternoon sunlight, 8K

Negative prompt

(deformed, distorted, disfigured, doll:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, 3d, illustration, cartoon, flat , dull , soft, (deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs,

其他数值

四、都用相关应用软件与相当多应用程序4.1 装上LoRa相当多应用程序Additional Networks

常用Lora必不可少的相当多应用程序,Additional Networks可以用来支配checkpoint+LoRa或者多个LoRa三维生成混合于风格的影像,并且可以另设Lora三维的Weight。装上方式如下:

打开stable-diffusion-webui,浏览【Extensions】- 【Install from URL】可用然后浏览【Install】等待装上,直到在【Installed】中都显示,然后从外部用指示来进行时stable-diffusion-webui(不是reload webui),强烈中选所有相当多应用程序装上来进行时都指示来进行时stable-diffusion-webui,可以免去很多麻烦。再一浏览【Setting】-【Additional Networks】可用LoRa元数据夹的绝对路径,如/root/stable-diffusion-webui/models/Lora(示例,叮嘱填写你的子系统路径),然后【Reload UI】等待来进行时来进行时。

然后可以在【txt2img】或【img2img】中都并不需要Lora三维并另设权重常用。

4.2 装上ControlNet

作为Stable Diffusion必装相当多应用程序,ControlNet 必需用户对生成的影像来进行精细的支配,以赢得愈来愈好的音效,ControlNet让AI版画的可控性有了质的突变,让AGIC真正的可以投入生产常用。打开stable-diffusion-webui,浏览【Extensions】- 【Install from URL】可用然后浏览【Install】等待装上,直到在【Installed】中都显示,然后从外部用指示来进行时stable-diffusion-webui(不是reload webui)。由于controlNet不会常用很多三维,所以在来进行时的时候不会默认流媒体,如果流媒体败北或加班,能够手进流媒体到controlnet编目。到访huggingface.co寻找controlnet的接收者:

手进流媒体里面三维元数据到stable-diffusion-webui/extensions/sd-webui-controlnet/models编目,查看已流媒体controlnet三维:

流媒体来进行时,来进行时stable-diffusion-webui均可在【txt2img】或【img2img】常用。

4.3 jupyter Notebook

Jupyter Notebook是一个基于网页的交互生存环境,可以用来编辑、列车运行Python编译器,图形学看到列车运行结果。同时透过了坚实的元数据树加载功能等。如已在各集2.4中都装上了Anaconda,从外部常用下述指示列车运行notebook

jupyter notebook ----allow-root ----NotebookApp.token='另设你的token'

到访IP+8888适配器,可以开始常用notebook

4.4 三维体能训练应用软件Kohya_ss

Kohya_ss是为人所知中选体能训练Stable Diffusion三维的图形学应用软件,尤其在windows平台支持比较好,经过想法在linux从外部常用不会遇到各种生存环境原因的疑问,为了避免这些疑问,十分中选常用docker装上。必先按照docker官方文档装上好docker,Ubuntu装上docker文档:由于在docker容器中都能够常用GPU资源,所以还能够必先装上NVIDIA Container Toolkit

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit-base# 查看是否装上事与愿违nvidia-ctk ----version

然后流媒体kohya_ss:

git clone _ss.git

如下图,修改kohya_ss/docker-compose.yaml元数据适配器为0.0.0.0:7861:7860(将kohya_ss的7860适配器映射到宿Dreamcast的7861适配器,因为7860不会被Stable Diffusion WebUI占用),启进数值另设为"----username xxxx ----password xxxx ----headless",肯定替换xxxx为能够另设的账号破解

然后执行者

docker compose build # 首次执行者能够builddocker compose run ----service-ports kohya-ss-gui

过程中都不会从huggingface.co流媒体三维元数据,如果流媒体败北,可以想法手进流媒体到编目kohya_ss/.cache/user/huggingface/hub/models----openai----clip-vit-large-patch14/snapshots/8d052a0f05efbaefbc9e8786ba291cfdf93e5bff,再一的hash值肯定改成相异的原版。流媒体接收者,肯定流媒体全部元数据

流媒体来进行时,然后到访适配器+7861适配器,可以开始常用Kohya_ss体能训练三维了。

五、阐述

装上完Stable Diffusion及里面的中选相当多应用程序,你的Stable Diffuion已经具备强大的生产力。后续我不会在此之后同大家一起追寻和倾听愈来愈多的常用知识,敬叮嘱期待系列文章下四集。现在出售雄州阳GPU阳Dreamcast新人即享99元7天的一折玩游戏一价(合于0.59元/小时),即刻带进道家之旅。

作者:雄州科技 王雷

举例来说:雄州阳技术开发者社区

胃反酸是怎么回事
先声必奇蒙脱石散
肩周炎怎么治疗最有效
孩子止泻用丁桂儿肚脐贴还是肠炎宁
脉管炎
标签:
友情链接: