Eric Guo's blog.cloud-mes.com

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

Running Stable Diffusion v2.1 Base on the Mac Studio and macOS 13 Ventura

Permalink

Stable Diffusion and MidJourney are the two of the most popular text-to-image models today.. MidJourney need to pay minimal $8 per month but Stable Diffusion is $9 per month but you can freely to run in local.

I have no NVidia GPU, but I have a Base model of Mac Studio, so I would like to try after Apple declared CoreML support Stable Diffusion.

Please make sure you have a good network and have upgraded macOS, aka macOS Ventura before beginning.

brew install miniconda
gh repo clone apple/coremltools
cd coremltools # just clone repo
conda init bash
./scripts/build.sh --python=3.10
xcode-select --install

Then running

python -m python_coreml_stable_diffusion.pipeline --prompt "a photo of an astronaut riding a horse on mars" -i models/coreml-stable-diffusion-v1-4_original_packages -o output --compute-unit CPU_AND_GPU --seed 305
# If not running stable-diffusion-v1-4, the --model-version must be specified.
python -m python_coreml_stable_diffusion.pipeline --prompt "a photo of an astronaut riding a horse on mars" --compute-unit CPU_AND_GPU -o output --seed 1106 -i models/coreml-stable-diffusion-2-1-base_original_packages --model-version stabilityai/stable-diffusion-2-1-base
# Fix the model path if an error is reported.
subl /opt/homebrew/Caskroom/miniconda/base/lib/python3.10/site-packages/python_coreml_stable_diffusion/pipeline.py
subl /opt/homebrew/Caskroom/miniconda/base/lib/python3.10/site-packages/python_coreml_stable_diffusion/coreml_model.py

Comments