리눅스(Ubutu)에 스테이블디퓨젼(Stable-diffusion)에 대한 검색을 많이 해보게 되었습니다. 알고 보니 이 프로그램은 알고리즘으로 볼 수 있었고 사실상 사용하기 위해서는 UI 프로그램을 설치해야 합니다. 이 알고리즘(소스 코드)은 오픈소스로 누구나 추가로 개발하여 이용할 수 가 있습니다. 가장 많이 사용하는 버전은 AUTOMATIC111로 된 웹 브라우저를 이용할 수 있는 것이었습니다.
왜 리눅스(Ubuntu)로 스테이블디퓨젼(stable-diffusion)을 사용하는가?
웹 브라우저로 사용할 수 있다는 것은 사실 이 시스템을 서버로 구현이 가능하는 얘기입니다. 즉, 언제 어디서나 어느 기기로도 접속이 가능하게 만들 수 있다는 것입니다.
10년 이상을 서버를 만들어 왔습니다. 윈도우에 설치하는 것보다, 리눅스로 서버로 만드는 것이 편한 사람이 바로 저란 사람입니다. 그래서 구글링을 많이 해봤지요. 불과 몇달 전까지만 해도 리눅스에 스테이블디퓨젼을 설치하는 정보가 많이 없었습니다. 그래서 꼭 블로그로 남겨야겠다고 생각했습니다. (조금 늦은 지금은 그래도 좀 많이 생겼네요.)
앞서 말했듯이 많은 분들이 AUTOMATIC111 버전으로 설치합니다. 이 버전은 웹 브라우저로 사용을 하는 가장 좋은 장점이 있습니다
- 웹 브라이저(크롬, 사파리, 엣지, 파이어폭스 등)만 있으면 언제 어디서나 이용할 수 있다.
- 그렇기 때문에 컴퓨터, 노트북, 모바일 기기를 구분하지 않고 사용할 수 있다.
하지만 위와 같이 any time, anywhere connection은 윈도우에 설치로 개인적으로는 복잡하고 힘들고 전력이 많이 소모될 거라고 생각이 들었습니다. 무엇보다도 윈도우 라이선스 비용도 10만원 추가될 거 같고요.
따라서 매일 켜 놓을 수 있고 심지어 윈도우를 구매하지 않는 방법은 정말 간단하게 리눅스입니다. 장점도 정리해볼까요?
스테이블 디퓨젼(AUTOMATIC 111)을 리눅스에 설치했을 때 장점
- 리눅스 OS와 오픈소스라서 무료로 사용할 수 있습니다.
- AUTUMATIC111 버전은 web-ui이고 오픈소스라서 무료로 사용할 수 있습니다.
- 윈도우 설치하는 것보다 훨씬 쉽게 설치할 수 있습니다. (그나마 설치할 것이 덜 하다.)(굉장히 주관적, 내 입장)
- web-ui는 말그대로 웹 브라우저로 이용할 수 있다. 그렇기 때문에 언제 어디서든 접속하여 이용할 수 있습니다.
그래서 리눅스로 결정했습니다. 이것을 사용하기 위해 그래픽 카드도 구매했습니다. 구매한 그래픽카드는 엔비디아 지포스 RTX 3060 12G 로 구매했고 스테이블디퓨젼을 사용하는 용도 외에는 없기 때문에 가성비가 가장 좋은 것으로 생각됩니다.
그리고 그래픽카드의 동작이 최소화되어 전력을 아끼는 방식으로 설정을 했습니다. 사실 그래픽카드 드라이버를 설치하면 전력을 알아서 관리해줍니다.
이번 포스팅은 리눅스와 그래픽카드 드라이버가 설치 완료됐다는 전제하에 진행합니다. 리눅스 설치와 그래픽카드 드라이버 설치가 궁금하신 분들은 아래의 링크로 이동하여 진행 해보시길 바랍니다.
설치하기
본격적으로 설치하기 위해선 의존성이 있는 프로그램들이 설치되어야 합니다. 실행 파일일 수도 있고 라이브러리 파일일 수도 있다. 윈도우에서는 닷넷프레임워크 설치하라고 하는 것과 비슷합니다.
간단하게 스테이블디퓨젼을 설치하기 위한 조건은 다음과 같습니다.
- 의존성 프로그램 설치 (gcc, git, python3-venv, pip, PIP Packaging)
- webui.sh 가 있는 디렉토리와 해당 파일에 실행 권한 주기
- root 계정이 아닌 개인 계정으로 설치하기
의존성 프로그램 설치 (gcc, git, python3-venv, pip, pip packaging)
첫번째 조건으로 스테이블디퓨전을 사용하기 위한 의존성 프로그램을 설치해야 합니다.
gcc 설치
GNU Compiler Collection, 줄여서 GCC로 불리는 이것은 GNU 프로젝트의 일환으로 개발되어 널리 쓰이고 있는 컴파일러이다.
자유 소프트웨어 중에 가장 잘 알려진 것들 중 하나인 GCC는 원래 C만을 지원했던 컴파일러로 이름도 “GNU C 컴파일러”였다. 이러한 까닭에 현재에도 GCC는 GNU 컴파일러 모음의 일부인 GNU C 컴파일러(GNU C Compiler)의 줄임말로 쓰이는 편이다. 그러나 나중에 C++, 자바, 포트란, 에이다 등 여러 언어를 컴파일할 수 있게 되면서 현재의 이름으로 바뀌게 되었다.
위키백과 (https://ko.wikipedia.org/wiki/GNU_%EC%BB%B4%ED%8C%8C%EC%9D%BC%EB%9F%AC_%EB%AA%A8%EC%9D%8C)
root@p-ai-img-svr:/product# sudo apt-get install gcc
설명은 거창하지만 위와 같이 간단하게 명령어 한 줄로 gcc를 설치할 수 있습니다.
git 설치
깃(Git /ɡɪt/[5])은 컴퓨터 파일의 변경사항을 추적하고 여러 명의 사용자들 간에 해당 파일들의 작업을 조율하기 위한 스냅샷 스트림 기반의 분산 버전 관리 시스템이다. 또는 이러한 명령어를 가리킨다.
소프트웨어 개발에서 소스 코드 관리에 주로 사용되지만 어떠한 파일 집합의 변경사항을 지속적으로 추적하기 위해 사용될 수 있다. 기하학적 불변 이론을 바탕으로 설계됐고, 분산 버전 관리 시스템으로서 빠른 수행 속도에 중점을 두고 있는 것[7]이 특징이며 데이터 무결성,[8] 분산, 비선형 워크플로를 지원한다.[9]
위키백과(https://ko.wikipedia.org/wiki/%EA%B9%83_(%EC%86%8C%ED%94%84%ED%8A%B8%EC%9B%A8%EC%96%B4))
root@p-ai-img-svr:/product# add-apt-repository ppa:git-core/ppa
PPA publishes dbgsym, you may need to include 'main/debug' component
.
.
.
root@p-ai-img-svr:/product# apt update; apt install git
Hit:1 http://kr.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates InRelease
.
(생략)
.
.
Unpacking git-man (1:2.42.0-0ppa1~ubuntu22.04.1) over (1:2.34.1-1ubuntu1.10) …
Setting up git-man (1:2.42.0-0ppa1~ubuntu22.04.1) …
Setting up git (1:2.42.0-0ppa1~ubuntu22.04.1) …
Processing triggers for man-db (2.10.2-1) …
Scanning processes…
Scanning processor microcode…
Scanning linux images…
Running kernel seems to be up-to-date.
The processor microcode seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@p-ai-img-svr:/product#
git을 설치하기 위해 apt에 repository를 설정하고, 적용합니다. 그 후에 apt install 명령어를 통해 git를 설치해줍니다. 위와 같이 두줄의 명령어로 설치가 간단하게 가능합니다.
python3-venv 설치
python3-venv를 설치한다. 파이썬이 설치되어 있다는 전제하이다. 리눅스는 왠만하면 기본적으로 파이썬이 설치가 되어 있다. 파이썬의 venv 라이브러리를 설치해준다. venv는 python3에서 기본으로 제공하는 가상환경(virtualenv)을 만들 수 있는 라이브러리이다.
파이썬(Python)은 1991년 네덜란드계 소프트웨어 엔지니어인 귀도 반 로섬이 발표한 고급 프로그래밍 언어로, ‘인터프리터를 사용하는 객체지향 언어’이자 플랫폼에 독립적인, 동적 타이핑(dynamically typed) 대화형 언어이다.
파이썬은 비영리의 파이썬 소프트웨어 재단이 관리하는 개방형, 공동체 기반 개발 모델을 가지고 있다. 현대의 파이썬은 여전히 인터프리터 언어처럼 동작하나 사용자가 모르는 사이에 스스로 파이썬 소스 코드를 컴파일하여 바이트 코드(Byte code)를 만들어 냄으로써 다음에 수행할 때에는 빠른 속도를 보여 준다.
위키백과(https://ko.wikipedia.org/wiki/%ED%8C%8C%EC%9D%B4%EC%8D%AC)
root@p-ai-img-svr:/product# apt install python3-venv
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following packages were automatically installed and are no longer required:
libflashrom1 libftdi1-2
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
python3-pip-whl python3-setuptools-whl python3.10-venv
The following NEW packages will be installed:
python3-pip-whl python3-setuptools-whl python3-venv python3.10-venv
0 upgraded, 4 newly installed, 0 to remove and 1 not upgraded.
Need to get 2,474 kB of archives.
After this operation, 2,888 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://kr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 python3-p ip-whl all 22.0.2+dfsg-1ubuntu0.3 [1,679 kB]
Get:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 python3-s etuptools-whl all 59.6.0-1.2ubuntu0.22.04.1 [788 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 python3.1 0-venv amd64 3.10.12-1~22.04.2 [5,724 B]
.
(생략)
.
.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@p-ai-img-svr:/product#
파이썬의 라이브러리도 위와 같이 apt install 명령어를 통해 간단히 설치가 가능합니다.
그외 의존성이 있는 라이브러리 설치하기
그 외에 필요한 의존성이 있는 라이브러리 파일을 설치해줍니다. libgl,1 libglib2.0-0, libflashrom1, libftdi1-2 등의 라이브러리인데, 그 내용을 잘 모르지만 필요하다고 하니 설치를 해줍니다.
root@p-ai-img-svr:/product# apt install libgl1 libglib2.0-0 libflashrom1 libftdi1-2
위와 같이 한번에 apt install를 통해 설치할 수 있습니다. 다만, 이 라이브러리 파일은 가장 나중에 설치해줘야 오류가 나지 않는 다는 것만 알고 설치해야 합니다.
이런 의존성들을 어떻게 알았는지 의문이 생기실 수 있습니다. 가장 간단하고 신뢰가 가는 방법은 이 스테이블디퓨젼의 AUTOMATIC1111을 만든 사람의 공식 페이지를 방문하는 겁니다. 아주 직관적으로 가이드를 작성해 놓았으니 참고하시면 좋겠습니다.
PIP, PIP Packaging 설치
스테이블디퓨젼은 파이썬 기반으로 작동이 됩니다. 따라서 파이썬에서 사용하는 패키지 프로그램을 추가로 설치해주어야 합니다. PIP와 PIP Packaging이라는 것을 설치합니다.
pip는 파이썬(python)으로 작성된 패키지 소프트웨어를 설치 · 관리하는 패키지 관리 시스템이다. Python Package Index (PyPI)에서 많은 파이썬 패키지를 볼 수 있다. 2020년 1월 1일자로 파이썬 2의 지원이 종료되었다. 현재는 파이썬3 버전이 기본으로 지원 및 포함하고 있다.
위키백과(https://ko.wikipedia.org/wiki/Pip_(%ED%8C%A8%ED%82%A4%EC%A7%80_%EA%B4%80%EB%A6%AC%EC%9E%90))
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ sudo apt install pip
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Note, selecting 'python3-pip' instead of 'pip'
The following additional packages will be installed:
build-essential dpkg-dev fakeroot g++ g++-11 javascript-common libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libexpat1-dev libfakeroot libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.10-dev libstdc++-11-dev
lto-disabled-list make python3-dev python3-wheel python3.10-dev zlib1g-dev
Suggested packages:
debian-keyring g++-multilib g++-11-multilib gcc-11-doc apache2 | lighttpd | httpd libstdc++-11-doc make-doc
The following NEW packages will be installed:
build-essential dpkg-dev fakeroot g++ g++-11 javascript-common libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libexpat1-dev libfakeroot libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.10-dev libstdc++-11-dev
lto-disabled-list make python3-dev python3-pip python3-wheel python3.10-dev zlib1g-dev
0 upgraded, 24 newly installed, 0 to remove and 88 not upgraded.
Need to get 22.3 MB of archives.
After this operation, 84.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libstdc++-11-dev amd64 11.4.0-1ubuntu1~22.04 [2,101 kB]
Get:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 g++-11 amd64 11.4.0-1ubuntu1~22.04 [11.4 MB]
Get:3 http://kr.archive.ubuntu.com/ubuntu jammy/main amd64 g++ amd64 4:11.2.0-1ubuntu1 [1,412 B]
.
(생략)
.
.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ pip install packaging
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: packaging in /home/gyeominater/.local/lib/python3.10/site-packages (23.1)
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ sudo pip install packaging
Collecting packaging
Downloading packaging-23.1-py3-none-any.whl (48 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 KB 1.2 MB/s eta 0:00:00
Installing collected packages: packaging
Successfully installed packaging-23.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$
가장 처음으로는 apt install을 통해 pip를 설치하는 것입니다. 설치가 완료되면 다시한번 pip install 명령어를 통해 packaging을 설치합니다. 이렇게 하여 의존성이 있는 프로그램을 모두 설치하였습니다.
Stable-diffusion의 AUTOMATIC111 다운로드 및 실행
이제는 실제로 AUTOMATIC1111을 설치하는 방법을 기술합니다. 가장 먼저 아래의 명령어를 통해 AUTOMATIC111 버전의 스테이블디퓨젼(Stable-diffusion)을 다운로드 받습니다. 그리고 다운로드가 잘 받아졌는지 ls 명령어로 확인해봅니다.
root@p-ai-img-svr:/product# wget -q https://raw.githubusercontent.com/AUTOMATIC1 111/stable-diffusion-webui/master/webui.sh
root@p-ai-img-svr:/product# ls
webui.sh
그리고 스크립트 파일로 된 webui.sh가 잘 다운로드 받아진 것을 확인할 수 있습니다. 이를 실행해 보도록하겠습니다. 단, 위에서 설명한 조건이 두가지가 있었죠. 파일에 실행권한을 주는 것입니다. 또한 root 계정이 아닌 개인 계정으로 실행해야 합니다.
root@p-ai-img-svr:/product# ls -al
total 25452
drwxr-xr-x 3 root root 68 Sep 6 01:20 .
drwxr-xr-x 22 root root 4096 Sep 5 11:44 ..
-rw-r--r-- 1 root root 8098 Sep 6 01:12 webui.sh
root@p-ai-img-svr:/product# chmod 777 webui.sh
root@p-ai-img-svr:/product# chown gyeominater. webui.sh
root@p-ai-img-svr:/product# ls -al
total 25452
drwxr-xr-x 3 root root 68 Sep 6 01:20 .
drwxr-xr-x 22 root root 4096 Sep 5 11:44 ..
-rwxrwxrwx 1 gyeominater gyeominater 8098 Sep 6 01:12 webui.sh
위와 같이 chmod와 chown 명령어로 실행권한과 소유자를 모두 변경하였습니다. 그리고 아래와 같이 실행하여 설치를 시킵니다.
gyeominater@p-ai-img-svr:/product$ ./webui.sh
#
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
#
#
Running on gyeominater user
#
#
Clone stable-diffusion-webui
#
.
(생략)
.
.
Downloading https://download.pytorch.org/whl/cu118/torch-2.0.1%2Bcu118-cp310-cp310-linux_x86_64.whl (2267.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 GB ? eta 0:00:00
Collecting torchvision==0.15.2
Downloading https://download.pytorch.org/whl/cu118/torchvision-0.15.2%2Bcu118-cp310-cp310-linux_x86_64.whl (6.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 9.1 MB/s eta 0:00:00
Collecting typing-extensions
Downloading typing_extensions-4.7.1-py3-none-any.whl (33 kB)
.
(생략)
.
.
Successfully installed MarkupSafe-2.1.3 certifi-2023.7.22 charset-normalizer-3.2.0 cmake-3.27.4.1 filelock-3.12.3 idna-3.4 jinja2-3.1.2 lit-16.0.6 mpmath-1.3.0 networkx-3.1 numpy-1.25.2 pillow-10.0.0 requests-2.31.0 sympy-1.12 torch-2.0.1+cu118 torchvision-0.15.2+cu118 triton-2.0.0 typing-extensions-4.7.1 urllib3-2.0.4
Installing clip
Installing open_clip
.
(생략)
.
.
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to /product/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.97G/3.97G [00:41<00:00, 102MB/s]
Calculating sha256 for /product/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors: Running on local URL: http://127.0.0.1:7860
.
(생략)
.
.
Startup time: 364.5s (prepare environment: 309.8s, import torch: 6.6s, import gradio: 2.1s, setup paths: 1.4s, initialize shared: 0.3s, other imports: 0.7s, setup codeformer: 0.1s, list SD models: 42.2s, load scripts: 0.6s, create ui: 0.5s, gradio launch: 0.1s).
6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa
Loading weights [6ce0161689] from /product/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Creating model from config: /product/stable-diffusion-webui/configs/v1-inference.yaml
Downloading (…)olve/main/vocab.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████| 961k/961k [00:00<00:00, 1.23MB/s]
Downloading (…)olve/main/merges.txt: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 525k/525k [00:00<00:00, 901kB/s]
Downloading (…)cial_tokens_map.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 389/389 [00:00<00:00, 1.89MB/s]
Downloading (…)okenizer_config.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 905/905 [00:00<00:00, 4.61MB/s]
Downloading (…)lve/main/config.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 4.52k/4.52k [00:00<00:00, 17.6MB/s]
Applying attention optimization: Doggettx… done.
Model loaded in 9.8s (calculate hash: 3.3s, load weights from disk: 0.2s, create model: 4.0s, apply weights to model: 2.0s, calculate empty prompt: 0.1s).
위와 같이 Model loaded 라는 로그 결과가 출력되면, 정상적으로 AUTOMATIC1111의 webui 실행이 잘 되었다는 것입니다. 이렇게 간단히 리눅스에서 스테이블디퓨젼 설치를 진행해보았습니다.
초기 설정하기
위에서 webui 버전의 장점이 있다고 했습니다. 그것은 바로 웹사이트처럼 언제 어디서나 접속이 가능하다는 것입니다. 하지만 이를 활용하기 위해서는 추가로 설정해야 하는 것이 있습니다. 그 외에도 적용해놓으면 좋은 여러가지 설정을 간단하게 설명하고 블로그 포스팅을 마치겠습니다.
그전에 먼저 webui-user.sh라는 파일에 대해서 알아야 합니다.
webui-user.sh – 사용자 편의를 위한 설정 파일
sh 확장자 파일이지만, 이건 실행을 위한 파일이 아니라 설정을 위한 파일입니다. 이 파일에 설정을 하나하나 씩 추가하여 사용자에게 편의를 줄 수 있습니다.
원격 접속을 위한 설정 (–listen)
기본 설정은 설치한 서버에서만 접속할 수 있도록 되어 있습니다. 그래서 원격으로 접속하기 위한 설정을 해주어야 합니다. 정말 간단한데요. webui-user.sh파일 내 13번째 줄에 아래와 같이 옵션을 넣고 webui를 재실행하면 됩니다.
권한 부여를 위한 설정 (–enable-insecure-extension-access)
스테이블디퓨전은 많은 확장프로그램을 제공합니다. 또한 그 것을 이용해 더 좋은 퀄리티의 사진을 생성할 수 있죠. 그렇기 때문에 확장프로그램 설치에 대한 권한이 자유로워야 합니다. 하지만 이 권한 또한 기본 설정에는 권한이 부여되지 않아 있습니다.
이 두가지를 모두 설정하기 위해서는 아래와 같이 두가지 옵션을 추가해줍니다.
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ vi ./webui-user.sh
# Commandline arguments for webui.py, for example: export COMMANDLINE_ARGS="--medvram --opt-split-attention"
export COMMANDLINE_ARGS="--listen --enable-insecure-extension-access"
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$
옵션 | 설명 |
–listen | 모든 IP 대역에서 접속 가능 |
–enable-insecure-extension-access | 모든 유저가 확장프로그램을 설치할 수 있는 권한을 부여 |
Webui를 통해 Extension을 On/Off하려면 반드시 webui.sh로 실행해야 합니다. 아래와 같이 다시 한번 webui.sh를 재실행해줍니다.
## 위와 같이 정상적으로 설치가 완료되면 다시 webui.sh를 실행하여 확인한다.
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ ./webui.sh
#
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
#
#
Running on gyeominater user
#
#
Repo already cloned, using it as install directory
#
#
Create and activate python venv
#
#
Launching launch.py…
#
Cannot locate TCMalloc (improves CPU memory usage)
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: v1.6.0
Commit hash: 5ef669de080814067961f28357256e8fe27544f4
Installing requirements
Launching Web UI with arguments: --listen --enable-insecure-extension-access
/usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
no module 'xformers'. Processing without…
no module 'xformers'. Processing without…
No module 'xformers'. Proceeding without it.
Loading weights [6ce0161689] from /PRODUCT/sd-151/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Running on local URL: http://0.0.0.0:7860
To create a public link, set share=True
in launch()
.
Startup time: 45.4s (prepare environment: 38.5s, import torch: 3.0s, import gradio: 0.8s, setup paths: 0.6s, initialize shared: 0.4s, other imports: 0.6s, load scripts: 0.5s, create ui: 0.7s, gradio launch: 0.2s).
Creating model from config: /PRODUCT/sd-151/configs/v1-inference.yaml
Applying attention optimization: Doggettx… done.
Model loaded in 4.5s (load weights from disk: 1.1s, create model: 0.8s, apply weights to model: 2.3s, calculate empty prompt: 0.1s).
실행된 로그를 확인하면 최신 버전인 1.6.0 으로 설치되어 있는 것을 확인할 수 있습니다. 패스트캠퍼스에서 듣는 강의 버전은 1.5.1 버전을 사용할 예정입니다. 따라서 버전 변경 방법은 아래의 링크를 통해 확인하도록 합시다.
필수 확장프로그램 설치
이 프로그램을 사용하기 위해서 필요한 것은 확장프로그램입니다. 정말 많은 확장프로그램이 있지만, 지금 당장 공부하기 위한 필수 확장프로그램을 아래와 같이 나열해놓았습니다. 아래의 필수 확장 프로그램을 다운로드 해주도록 합시다.
필수 확장 프로그램: controlnet, Regional Prompt, Merge Block Weighted, Agent Scheduler, Image Browser, Install List
https://github.com/Mikubill/sd-webui-controlnet https://github.com/Bing-su/adetailer https://github.com/hako-mikan/sd-webui-regional-prompter https://github.com/hako-mikan/sd-webui-lora-block-weight https://github.com/adieyal/sd-dynamic-prompts https://github.com/fkunn1326/openpose-editor https://github.com/nonnonstop/sd-webui-3d-open-pose-editor https://github.com/huchenlei/sd-webui-openpose-editor https://github.com/Coyote-A/ultimate-upscale-for-automatic1111 https://github.com/ArtVentureX/sd-webui-agent-scheduler https://github.com/continue-revolution/sd-webui-segment-anything https://github.com/alemelis/sd-webui-ar https://github.com/AlUlkesh/stable-diffusion-webui-images-browser https://github.com/vladmandic/sd-extension-system-info https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper https://github.com/DominikDoom/a1111-sd-webui-tagcomplete https://github.com/bbc-mc/sdweb-merge-block-weighted-gui |
웹브라우저를 실행하기 전에 필수 확장프로그램까지 설치해버려서 기본 레이아웃을 볼 수 없었지만, 딱히 중요하지 않습니다. 확장 프로로그램(Extension)을 설치하면 UI가 조금씩 바뀐다는 것만 숙지하시면 좋을 거 같습니다.

이렇게 이번 포스팅에서 스테이블디퓨젼을 어떻게 설치하고 초기 설정을 어떻게 하는지 포스팅하였습니다. 이 다음 포스팅에서는 실제로 스테이블 디퓨젼을 사용하는 방법들을 하나씩 천천히 포스팅해나가려고 합니다. 다음 포스팅을 기대해주세요.