首页 > 系统相关 >ubuntu22.04 部署 stable-diffusion-webui v1.1.0

ubuntu22.04 部署 stable-diffusion-webui v1.1.0

时间:2023-05-09 12:22:55浏览次数:52  
标签:diffusion anaconda3 ubuntu22.04 driver v1.1 conda nvidia data change

anaconda 设置

anaconda下载地址

https://www.anaconda.com/download#downloads

anaconda下载

# wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh

安装 anaconda

# bash Anaconda3-2023.03-1-Linux-x86_64.sh
....
Anaconda3 will now be installed into this location:
/root/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/root/anaconda3] >>> /data/anaconda3
PREFIX=/data/anaconda3
....
no change     /data/anaconda3/condabin/conda
no change     /data/anaconda3/bin/conda
no change     /data/anaconda3/bin/conda-env
no change     /data/anaconda3/bin/activate
no change     /data/anaconda3/bin/deactivate
no change     /data/anaconda3/etc/profile.d/conda.sh
no change     /data/anaconda3/etc/fish/conf.d/conda.fish
no change     /data/anaconda3/shell/condabin/Conda.psm1
no change     /data/anaconda3/shell/condabin/conda-hook.ps1
no change     /data/anaconda3/lib/python3.10/site-packages/xontrib/conda.xsh
no change     /data/anaconda3/etc/profile.d/conda.csh
modified      /root/.bashrc

配置 anaconda

$ /data/anaconda3/bin/conda init bash
no change     /data/anaconda3/condabin/conda
no change     /data/anaconda3/bin/conda
no change     /data/anaconda3/bin/conda-env
no change     /data/anaconda3/bin/activate
no change     /data/anaconda3/bin/deactivate
no change     /data/anaconda3/etc/profile.d/conda.sh
no change     /data/anaconda3/etc/fish/conf.d/conda.fish
no change     /data/anaconda3/shell/condabin/Conda.psm1
no change     /data/anaconda3/shell/condabin/conda-hook.ps1
no change     /data/anaconda3/lib/python3.10/site-packages/xontrib/conda.xsh
no change     /data/anaconda3/etc/profile.d/conda.csh
modified      /home/ubuntu/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

重新连接shell

anaconda 常用命令

1、创建环境:conda create -n <env_name> <packages>

2、激活环境:conda activate <env_name>

3、退出环境:conda deactivate <env_name>

4、查看已安装的环境信息:conda env list

5、复制环境:conda create -n <new_env_name> --clone <origin_env_name>

6、删除环境:conda env remove -n <env_name>

7、保存环境信息到environment.yaml文件中:conda env export > environment.yaml

8、通过environment.yaml环境文件创建文件: conda env create -f environment.yaml

9、查看已安装的包:conda list

10、搜索包:conda search <package_name1>

11、安装包:conda install <package_name1> <package_name2>

12、卸载包:conda remove <package_name>

GPU设置

系统更新

# apt -y update && apt -y upgrade

查看GPU驱动信息

# ubuntu-drivers  devices
== /sys/devices/pci0000:00/0000:00:03.0 ==
modalias : pci:v000010DEd00001E07sv000010DEsd000012FAbc03sc00i00
vendor   : NVIDIA Corporation
model    : TU102 [GeForce RTX 2080 Ti Rev. A]
driver   : nvidia-driver-515 - distro non-free
driver   : nvidia-driver-530-open - distro non-free recommended
driver   : nvidia-driver-530 - distro non-free
driver   : nvidia-driver-470 - distro non-free
driver   : nvidia-driver-418-server - distro non-free
driver   : nvidia-driver-510 - distro non-free
driver   : nvidia-driver-525-server - distro non-free
driver   : nvidia-driver-515-server - distro non-free
driver   : nvidia-driver-525-open - distro non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-515-open - distro non-free
driver   : nvidia-driver-525 - distro non-free
driver   : nvidia-driver-470-server - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin
# nvidia-detector
nvidia-driver-530

安装GPU驱动

# apt install nvidia-driver-530 -y

安装cuda-toolkit

# wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
# sudo dpkg -i cuda-keyring_1.0-1_all.deb
# sudo apt-get update
# sudo apt-get -y install cuda  nvidia-cuda-toolkit nvidia-cudnn

重启主机

# reboot

查看CUDA版本

# nvidia-smi 
Mon May  8 15:35:30 2023       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.41.03              Driver Version: 530.41.03    CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                  Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 2080 Ti      Off| 00000000:00:03.0 Off |                  N/A |
| 25%   27C    P8                6W / 250W|      1MiB / 11264MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0

python环境

创建虚拟环境

$ conda create -p /data/py_SD1 python=3.10.6
....
#
# To activate this environment, use
#
#     $ conda activate /data/py_SD1
#
# To deactivate an active environment, use
#
#     $ conda deactivate

启动环境

(base) ubuntu@192-168-0-193:/data$ conda activate /data/py_SD1
(/data/py_SD1) ubuntu@192-168-0-193:/data$ 

stable-diffusion-webui

安装依赖

# apt-get install google-perftools

安装 stable-diffusion-webui

(/data/py_SD1) ubuntu@192-168-0-193:/data$ bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh)

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on ubuntu user
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc.so.4
Python 3.10.6 (main, Oct 24 2022, 16:07:47) [GCC 11.2.0]
...

运行 stable-diffusion-webui

$ bash webui.sh --share --listen

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on ubuntu user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc.so.4
Python 3.10.6 (main, Oct 24 2022, 16:07:47) [GCC 11.2.0]
Commit hash: 5ab7f213bec2f816f9c5644becb32eb72c8ffb89
Installing requirements
Launching Web UI with arguments: --share --listen
No module 'xformers'. Proceeding without it.
Loading weights [6ce0161689] from /data/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Creating model from config: /data/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying cross attention optimization (Doggettx).
Textual inversion embeddings loaded(0): 
Model loaded in 3.3s (load weights from disk: 0.1s, create model: 0.8s, apply weights to model: 1.1s, apply half(): 0.3s, move model to device: 0.9s).
Running on local URL:  http://0.0.0.0:7860

webui-user.sh

如果 GPU 显存低于 4GB,添加:COMMANDLINE_ARGS=--medvram --opt-split-attention

如果您的 PC 内存低于 8GB,请添加:COMMANDLINE_ARGS=--lowvram --opt-split-attention

Stable Diffusion models

模型存放位置

stable-diffusion-webui/models/Stable-diffusion/

写实风格模型

Stable Diffusion, the original model published by CompVis and StabilityAI.

Chilloutmix

Deliberate

动漫风格模特

Anything

Waifu Diffusion

Hentai Diffusion

DreamShaper

OrangeMix3

参考文档

https://pytorch.org/get-started/previous-versions/

https://developer.nvidia.cn/cuda-toolkit-archive

https://developer.nvidia.cn/rdp/cudnn-archive

标签:diffusion,anaconda3,ubuntu22.04,driver,v1.1,conda,nvidia,data,change
From: https://www.cnblogs.com/wangguishe/p/17381926.html

相关文章

  • ubuntu22.04设置ftp服务
    本来家里的主机是有smb服务的,但是发现存在这样的一个问题:我用苹果手机可以访问smb,但是我使用安卓系统的电视是访问不了的。于是我搜索了一下,问题大概是高版本的smb是不支持低版本的安卓系统的后来我就想安装个ftp服务吧,本来想设置匿名访问的,但是没有设置成功,最后是通过本机登录......
  • 无界AI绘画基础教程,和Midjourney以及Stable Diffusion哪个更好用?
    本教程收集于:AIGC从入门到精通教程汇总简单的总结Midjourney,StableDiffusion,无界AI的区别?Midjourney,收费,上手容易,做出来高精度的图需要自己掌握好咒语。咒语写不好,像是抽奖。里面的模型基本都是大模型,小模型太少,需要一些辅助机器人或者辅助操作保持画风的一致。StableDiffus......
  • Ubuntu22.04 rc-local 配置开机自启动脚本
    1.rc-local服务简介Linux中的rc-local服务是一个开机自动启动的,调用开发人员或系统管理员编写的可执行脚本或命令的,它的启动顺序是在系统所有服务加载完成之后执行。ubuntu22.04系统已经默认安装了rc-local.service服务,但是不知什么原因系统把这个服务给“隐蔽”了,所以如果不做......
  • AI 作画火了,如何用 Serverless 函数计算部署 Stable Diffusion?
    作者:寒斜立即体验基于函数计算部署StableDiffusion:https://developer.aliyun.com/topic/aigcAIGC领域目前大火,除了Chatgpt,在文生图领域StableDiffusion大放异彩,深刻的地影响着绘画、视频制作等相关领域。利用这项技术,普通人也可以制作出令人惊叹的艺术作品。今天我们将......
  • 沁恒 CH32V208(三): CH32V208 Ubuntu22.04 Makefile VSCode环境配置
    目录沁恒CH32V208(一):CH32V208WBU6评估板上手报告和Win10环境配置沁恒CH32V208(二):CH32V208的储存结构,启动模式和时钟沁恒CH32V208(三):CH32V208Ubuntu22.04MakefileVSCode环境配置硬件部分CH32V208WBU6评估板WCH-LinkE或WCH-Link硬件环境与Windows下......
  • stable-diffusion-webui 环境设置过程记录
    今天在自己的电脑上设置成功stable-diffusion-webui的环境,现记录一下过程,希望对其他人有用环境:Windows11显卡:NvidiaGeforceRTX3090时间:2023/04/301.主流程基本按照这篇知乎文章来的:喂饭级stable_diffusion_webUI使用教程-知乎(zhihu.com),这其中安装git,安装python3,都比......
  • 使用Dino+SAM+Stable diffusion 自动进行图片的修改
    SAM是Mata发布的“SegmentAnythingModel”可以准确识别和提取图像中的对象。它可以分割任何的图片,但是如果需要分割特定的物体,则需要需要点、框的特定提示才能准确分割图像。所以本文将介绍一种称为GroundingDino的技术来自动生成SAM进行分割所需的框。除了分割以外,我......
  • ubuntu22.04取消开机输入密码(实测)
    打开终端sudonano/etc/gdm3/custom.conf在文件的[daemon]部分中添加以下两行代码:[daemon]AutomaticLoginEnable=TrueAutomaticLogin=username保存并关闭,注意usename值的是你自己登录的用户名第二步sudonano/etc/pam.d/gdm-password将下面一行注释掉authrequi......
  • 在Ubuntu22.04/16.04中安装MongoDB6.0
    一、MongoDB简介MongoDB是一个基于分布式文件存储的数据库,采用C++语言编写,旨在为Web应用提供可扩展的高性能数据存储解决方案。MongoDB是一个介于关系数据库和非关系数据库之间的产品,是目前非关系数据库当中功能最丰富、最像关系数据库的数据库。传统的关系数据库一般由数据库(da......
  • Ubuntu22.04 安装 mysql8,redis7,MongoDB6
     服务器的准备我的服务器是在腾讯云租的,所以服务器的apt源都是默认配好的,没配好的自行网上查找apt源配置。本文同样适用于Ubuntu22,20。Ubuntu18亦可参考。云服务器一般防火墙未开放端口访问,请自行配置,否则后续远程访问不了:mysql:3306redis:6379MongoDB:27017更新所有......