본문 바로가기
AI

[Stable Diffusion] WebUI Mac M1 에서 실행해보기

by bryan.oh 2023. 3. 22.
반응형

제 Mac 에서 webui 실행해서 생성한 이미지 입니다.

 

1. Brew 설치는 이전 글 참고

https://hello-bryan.tistory.com/223

 

[Mac] brew install . brew 설치하기

Linux의 apt-get 이나 yum 같은 패키지 매니저입니다. Brew site https://brew.sh/index_ko Homebrew The Missing Package Manager for macOS (or Linux). brew.sh 위 사이트에 설명이 다 나와있지만 간단히 설명하면 아래 명령어를

hello-bryan.tistory.com

 

2. 필요한 것들 설치

터미널을 열어서 아래 명령어 실행.

arch -arm64 brew install cmake protobuf rust python@3.10 git wget
m1 이기 때문에 arch -arm64 로 설치

이 설치는 오래걸릴 수 있기 때문에 아래 3번 clone, 4번 모델준비 까지 미리 해둡니다.

 

3. webui repository clone

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

적당한 경로에서 이 명령어를 실행하면 stable-diffusion-webui 라는 폴더가 생기면서 소스들이 다운로드 됩니다.

 

4. 모델 준비

생성 된 stable-diffusion-webui/models/Stable-diffusion 경로에 모델 파일이 없는 경우 
아래 링크(hugging face) 에서 다운로드 합니다. 확장자는 ".ckpt" 또는 ".safetensors"

다운로드 된 파일들을 stable-diffusion-webui/models/Stable-diffusion 이 폴더에 옮겨둡니다.

 

5. 실행

위 2번이 완료됐다면

git clone 했던 stable-diffusion-webui 폴더에서 아래 명령어를 실행합니다.

./webui.sh

Python 가상 환경은 venv를 사용하여 생성 및 활성화되며 누락된 종속성은 자동으로 다운로드 및 설치됩니다.

 

시간이 꽤 걸립니다.

기다리다가 메시지를 보니 제 torch 버전에 1.12.1 이라네요.

1.13.1 로 테스트 된거니까 업데이트 하라고..

다 됐습니다. 

localhost:7860 으로 접속해 봅니다.

촴~~ 쉽죠.

 

이제 필요한 모델들을 받고, 여러가지 prompt 를 이용해서 txt2img 나 img2img 등 webui 의 기능을 이용해 보시면 됩니다.

txt2img

img2img

anything model 사용

 

참고

mac 에서 512x512 이미지 생성하는데 1분 넘게 걸린다면 아래 글을 참고하세요.

Currently GPU acceleration on macOS uses a lot of memory. If performance is poor (if it takes more than a minute to generate a 512x512 image with 20 steps with any sampler) first try starting with the --opt-split-attention-v1 command line option (i.e. ./webui.sh --opt-split-attention-v1) and see if that helps. If that doesn't make much difference, then open the Activity Monitor application located in /Applications/Utilities and check the memory pressure graph under the Memory tab. If memory pressure is being displayed in red when an image is generated, close the web UI process and then add the --medvram command line option (i.e. ./webui.sh --opt-split-attention-v1 --medvram). If performance is still poor and memory pressure still red with that option, then instead try --lowvram (i.e. ./webui.sh --opt-split-attention-v1 --lowvram). If it still takes more than a few minutes to generate a 512x512 image with 20 steps with with any sampler, then you may need to turn off GPU acceleration. Open webui-user.sh in Xcode and change #export COMMANDLINE_ARGS="" to export COMMANDLINE_ARGS="--skip-torch-cuda-test --no-half --use-cpu all".

 

 

2023.03.22 - [AI] - [Stable Diffusion] Prompt 에 따른 생성 이미지 예제

 

[Stable Diffusion] Prompt 에 따른 생성 이미지 예제

Stable Diffusion 여러가지 prompt 를 입력하고, 결과를 확인하기 위해서 작성한 로그성 포스트 입니다. prompt {{{masterpiece}}}, {{{best quality}}}, {{ultra-detailed}}, {cinematic lighting}, {illustration}, {beautiful detailed eye

hello-bryan.tistory.com

2023.03.22 - [AI] - [Stable Diffusion] Sampling method 에 따른 이미지 생성 결과

 

[Stable Diffusion] Sampling method 에 따른 이미지 생성 결과

로그성 포스팅입니다. 별 내용없이 생성된 이미지 비교하려고 작성했습니다. 아래는 여러 커뮤니티에서 주워들은 이야기 입니다. PLMS, DPM++ 2M Karras 또는 LMS/Keras 을 사용하면 속도가 빠르다더라 t

hello-bryan.tistory.com

 

728x90
반응형

댓글