Skip to content

Instantly share code, notes, and snippets.

@toriato
Created January 1, 2023 11:09
Show Gist options
  • Save toriato/4a365110d84f39f9815c24879f72be9e to your computer and use it in GitHub Desktop.
Save toriato/4a365110d84f39f9815c24879f72be9e to your computer and use it in GitHub Desktop.
#!/bin/bash
# yo whatsup yalls, call me meow theif ;))) also checkout my colab notebook
shopt -s globstar
shopt -s nullglob
git clone --depth=1 https://github.com/toriato/easy-stable-diffusion
cd easy-stable-diffusion
mkdir -p SD/models/Stable-diffusion
# cuda_version=$(python -c 'import torch; print(torch.version.cuda)')
# echo "$(python -V)"
# echo "CUDA $cuda_version 을 사용하고 있습니다"
# WHY GOORM HAS NO libGL BY DEFAULT??
if ! ldconfig -p | grep libGL.so.1; then
echo '필수 라이브러리를 설치합니다'
apt-key adv --keyserver pgp.mit.edu --recv-keys A4B469963BF863CC # cudatools pubkey, goorm purged pubkey for small image size??? what?
apt update
apt install -y libgl1
fi
# install newer version of pytorch (again, goorm suck dick)
if [[ $(pip freeze | grep 'torch==') == *'1.10.2'* ]]; then
echo 'torch 패키지를 업데이트합니다'
pip install \
--upgrade \
--extra-index-url https://download.pytorch.org/whl/cu113 \
torch torchvision torchaudio # yeh i know we dont need torchaudio but i lazy af
fi
# install xformers
if ! pip freeze | grep xformers; then
echo 'xformers 패키지가 존재하지 않습니다, 패키지를 설치합니다'
curl -LO 'https://github.com/toriato/easy-stable-diffusion/raw/prebuilt-xformers/cu113/xformers-0.0.14.dev0-cp38-cp38-linux_x86_64.whl'
pip install xformers-0.0.14.dev0-cp38-cp38-linux_x86_64.whl
rm xformers-0.0.14.dev0-cp38-cp38-linux_x86_64.whl
fi
# download leaked and outdated novel's checkpoint
pushd SD/models/Stable-diffusion
checkpoints=(**/*.ckpt)
if [ ${#checkpoints} -eq 0 ]; then
echo '모델 파일이 존재하지 않습니다, 모델 파일을 받아옵니다'
curl -LO 'https://pub-2fdef7a2969f43289c42ac5ae3412fd4.r2.dev/animefull-final-pruned.ckpt'
curl -LO 'https://pub-2fdef7a2969f43289c42ac5ae3412fd4.r2.dev/animevae.pt'
curl -LO 'https://gist.githubusercontent.com/toriato/ae1f587f4d1e9ee5d0e910c627277930/raw/6019f8782875497f6e5b3e537e30a75df5b64812/animefull-final-pruned.yaml'
ln -s animefull-final-pruned.vae.pt animevae.pt
fi
popd
# default override.json
[ ! -f SD/override.json ] &&\
echo '{"GRADIO_USERNAME": ""}' > SD/override.json
# letsss gooooooooooooooo
python easy-stable-diffusion.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment