Last active
July 29, 2023 21:54
-
-
Save x/33a3364ad36bce61a481522660f95ba5 to your computer and use it in GitHub Desktop.
Revisions
-
x revised this gist
Dec 12, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,4 +46,4 @@ nuke: rm -f ~/.pyenv/versions/${VENV_NAME} generate: PYENV_VERSION=${VENV_NAME} VIRTUAL_ENV=${VENV} ${VENV}/bin/python -m python_coreml_stable_diffusion.pipeline --prompt "${PROMPT}" -i "${MLPACKAGES_DIR}" -o "${OUT_DIR}" --compute-unit ALL --seed 93 && open "${OUT_DIR}" -
x created this gist
Dec 12, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ .DEFAULT: setup SHELL = /bin/bash NAME := coreml_stable_diffusion PYMAJOR := 3 PYREV := 8 PYPATCH := 10 PYVERSION := ${PYMAJOR}.${PYREV}.${PYPATCH} PYENV := ~/.pyenv/versions/${PYVERSION} VENV_NAME := ${NAME}-${PYVERSION} VENV := ${PYENV}/envs/${VENV_NAME} EGGLINK := ${VENV}/lib/python${PYMAJOR}.${PYREV}/site-packages/${NAME}.egg-link MLPACKAGES_DIR=./mlpackages OUT_DIR=./out ${PYENV}: pyenv install ${PYVERSION} ${VENV}: ${PYENV} pyenv virtualenv ${PYVERSION} ${VENV_NAME} .python-version: ${VENV} echo ${VENV_NAME} >.python-version ${EGGLINK}: PYENV_VERSION=${VENV_NAME} VIRTUAL_ENV=${VENV} ${VENV}/bin/pip install -e . # an update-install might not necessarily update this touch ${EGGLINK} setup: .python-version ${EGGLINK} brew install huggingface-cli echo "Create an account for huggingface.co (where we're fetching the models from) if you don't have one already. Create and copy an auth token." open "https://huggingface.co/settings/tokens" huggingface-cli login PYENV_VERSION=${VENV_NAME} VIRTUAL_ENV=${VENV} ${VENV}/bin/python -m python_coreml_stable_diffusion.torch2coreml --convert-unet --convert-text-encoder --convert-vae-decoder --convert-safety-checker -o ${MLPACKAGES_DIR} clean: git clean -fdx nuke: git clean -fdx rm -f .python-version /usr/local/bin/pyenv uninstall -f ${PYVERSION} rm -f ~/.pyenv/versions/${VENV_NAME} generate: PYENV_VERSION=${VENV_NAME} VIRTUAL_ENV=${VENV} ${VENV}/bin/python -m python_coreml_stable_diffusion.pipeline --prompt "${PROMPT}" -i "${MLPACKAGES_DIR}" -o "${OUT_DIR}" --compute-unit ALL --seed 93 && open "${OUT_DIR}/${PROMPT}.png"