How to deploy an AI map of your own

At present, AI drawing only supports N card, and the video memory is at least 4G. When deploying, you must pay attention to the configuration of the device **

1. Deploy on windows

You can watch b station up: independent researcher-Xingkong's tutorial
AI painting [Stable Diffusion] NovelAI integration package decompresses and uses
AI painting [Stable Diffusion] NovelAI integration package WebUI update and latest settings
must complete the two tutorials completely, otherwise there is a computer Risk of being hacked **
⚠️ Be alert! Your NovelAI model is very likely to be maliciously attacked! Hidden behind the leaked AI painting model is a huge security risk!

2. Deploy on linux/GPU server (ubuntu)

Reference: Official Documents
There are various problems with automatic installation in official documents, manual installation is recommended here

2.1 Manage the environment with anaconda

2.1.1 Install anaconda

wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh
bash Anaconda3-2022.05-Linux-x86_64.sh

2.1.2 Create a virtual environment

  conda create --name NovelAI  python=3.9.12 # NovelAI为环境名,3.8为python的版本号

2.1.3 Activate the environment

conda activate NovelAI

2.2 Install stable-diffusion-webui

Run the code in turn, if Permission denied appears, add sudo before the corresponding command

# install torch with CUDA support. See https://pytorch.org/get-started/locally/ for more instructions if this fails.
pip install torch --extra-index-url https://download.pytorch.org/whl/cu113

# check if torch supports GPU; this must output "True". You need CUDA 11. installed for this. You might be able to use
# a different version, but this is what I tested.
python -c "import torch; print(torch.cuda.is_available())"

# clone web ui and go into its directory
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui

# clone repositories for Stable Diffusion and (optionally) CodeFormer
mkdir repositories
git clone https://github.com/CompVis/stable-diffusion.git repositories/stable-diffusion
git clone https://github.com/CompVis/taming-transformers.git repositories/taming-transformers
git clone https://github.com/sczhou/CodeFormer.git repositories/CodeFormer
git clone https://github.com/salesforce/BLIP.git repositories/BLIP

# install requirements of Stable Diffusion
pip install transformers==4.19.2 diffusers invisible-watermark --prefer-binary

# install k-diffusion
pip install git+https://github.com/crowsonkb/k-diffusion.git --prefer-binary

# (optional) install GFPGAN (face restoration)
pip install git+https://github.com/TencentARC/GFPGAN.git --prefer-binary

# (optional) install requirements for CodeFormer (face restoration)
pip install -r repositories/CodeFormer/requirements.txt --prefer-binary

# install requirements of web ui
pip install -r requirements.txt  --prefer-binary

# update numpy to latest version
pip install -U numpy  --prefer-binary

2.3 Model

There is no model just after installation, you need to download the model

2.3.1 Model directory

So the models are placed in this directory, and can be uploaded to this directory through sftp

stable-diffusion-webui\models\Stable-diffusion

2.3.2 Download various models

https://rentry.org/sdmodels

2.3.3 Recently leaked NovelAI models

Link: https://pan.baidu.com/s/1Mu_ynhBkkWi1Nr1nWl_Xyw?pwd=rs47
Extraction code: rs47

2.4 run

2.4.1 Local operation

python webui.py

2.4.2 Server running local remote access

python webui.py --listen

Then you can access it through the server port 7860 (remember to release the port on the server console)

http://<服务器公网ip>:7860/

2.4.3 Running in background

nohup python webui.py --listen 2>&1 &

More parameter settings

3. Deploy on colab

If your computer doesn’t have enough video memory and you don’t have a GPU server, you can deploy it in colab. You can use a piece of T4 for free. You only need a Google account, and there is no security risk. The disadvantage is that it is unstable and requires magic. Code: colab one-click deployment
Tutorial :
NovelAI 4chan Colab tutorial teaching: currently the closest to NovelAI's official and free version (requires magic)

Guess you like

Origin blog.csdn.net/qq_53570748/article/details/127361790