DEV Community

Setting up Stable Diffusion for MacOS

Craig Morten on August 26, 2022

With the landscape quickly changing, this article is fast becoming outdated! If you face issues with the tutorial below I recommend you checkout ...
Collapse
 
magnusviri profile image
James Reynolds • Edited

Hey all, I'm magnusviri. The instructions here need to be modified like this.

git checkout https://github.com/lstein/stable-diffusion

Don't check out anything. After conda activate ldm run this.

python scripts/preload_models.py

The latest instructions are here.

I haven't updated them with python scripts/preload_models.py. Anyone can get a github account, fork lstein's repo, update the readme with the latest info, and do a pull request to get it updated for everyone. This is the beauty of open source.

This stuff is moving extremely fast and is extremely complex. It's moving so fast that since it's moved from magnusviri/stable-diffusion to lstein/stable-diffusion I haven't even had time to double check that the readme is even accurate or update it with the latest list of errors plaguing people. While people are trying to make it as easy as possible this is nowhere near ready for the masses and non-power users.

Collapse
 
craigmorten profile image
Craig Morten

Nice one @magnusviri! I've put a notice at the top as my personal notes from having a play are fast becoming unfit for the enthusiasm of the community!

Collapse
 
asmang profile image
Greg Asman • Edited

Thanks for the detailed instructions! Unfortunately, I'm getting stuck at environment creation where pip is failing with the message below. Any thoughts on how to get over this hurdle? Thanks again!

(Note: It appears to be an issue with onnx. I tried a pip install onnx and it went through every version unsucessfully.)

Pip subprocess error:
  Running command git fetch -q --tags
  Running command git reset --hard -q 24268930bf1dce879235a7fddd0b2355b84d7ea6
  Running command git fetch -q --tags
  Running command git reset --hard -q d50d76daa670286dd6cacf3bcd80b5e4823fc8e1
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      fatal: not a git repository (or any of the parent directories): .git
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/kk/qyr1f5dj017b338m860tt9dm0000gn/T/pip-install-5of30ges/onnx_8af078f05ebe4736b1b65355c7b7406b/setup.py", line 81, in <module>
          assert CMAKE, "Could not find cmake executable!"
      AssertionError: Could not find cmake executable!
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

failed

CondaEnvException: Pip failed
Enter fullscreen mode Exit fullscreen mode
Collapse
 
careuno profile image
Carlos Merchán

im having the same issue, any clue?

Collapse
 
craigmorten profile image
Craig Morten • Edited

I’ll give my own instructions another go and see if can reproduce…

What version of python/pip are you using? IIRC you need to use python 3

Updates:

  1. If you followed the steps verbatim the conda installation step was incorrect - I have amended!
  2. Just noticed your error is regarding not having cmake, adding some env setup steps for this now! You need to install this brew install cmake
Thread Thread
 
careuno profile image
Carlos Merchán

I’ll check again installing cmake
Question: why are you using /Miniconda3-latest-MacOSX-x86_64.sh instead of /Miniconda3-latest-MacOSX-arm64.sh ?

Thread Thread
 
craigmorten profile image
Craig Morten

Miniconda3-latest-MacOSX-x86_64.sh is for "pre-M1" macs, e.g. I use a MacBook Air 2017 which uses an Intel chip.

Miniconda3-latest-MacOSX-arm64.sh is for Apple M1 😄

Thread Thread
 
careuno profile image
Carlos Merchán

I was confused because you use apple-silicon-mps-support branch and I thought you had a M1 cpu. Anyway now it's working for me, thanks

Collapse
 
tangsirongit profile image
laimj • Edited

Thanks for the detailed instructions!

after set up the enviroment.

the last step:
python scripts/orig_scripts/txt2img.py --prompt "An Armenia girl with curly hair goes to Senior school with her mum in Shanghai, and she carries a dark red shoulder bag" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1

the error:

Loading model from sd-v1-4.ckpt
Global Step: 470000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Traceback (most recent call last):
  File "/Users/tangsir/Downloads/tools/stable-diffusion/scripts/orig_scripts/txt2img.py", line 327, in <module>
    main()
  File "/Users/tangsir/Downloads/tools/stable-diffusion/scripts/orig_scripts/txt2img.py", line 203, in main
    model = load_model_from_config(config, f"{opt.ckpt}")
  File "/Users/tangsir/Downloads/tools/stable-diffusion/scripts/orig_scripts/txt2img.py", line 42, in load_model_from_config
    model = instantiate_from_config(config.model)
  File "/Users/tangsir/Downloads/tools/stable-diffusion/ldm/util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config['target'])(
  File "/Users/tangsir/Downloads/tools/stable-diffusion/ldm/models/diffusion/ddpm.py", line 657, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "/Users/tangsir/Downloads/tools/stable-diffusion/ldm/models/diffusion/ddpm.py", line 768, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "/Users/tangsir/Downloads/tools/stable-diffusion/ldm/util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config['target'])(
  File "/Users/tangsir/Downloads/tools/stable-diffusion/ldm/modules/encoders/modules.py", line 253, in __init__
    self.tokenizer = CLIPTokenizer.from_pretrained(
  File "/Users/tangsir/opt/anaconda3/envs/ldm/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1768, in from_pretrained
    raise EnvironmentError(
OSError: Can't load tokenizer for 'openai/clip-vit-large-patch14'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-large-patch14' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.
Enter fullscreen mode Exit fullscreen mode
Collapse
 
tangsirongit profile image
laimj

fixed by removing local_files_only=True:

diff --git a/ldm/modules/encoders/modules.py b/ldm/modules/encoders/modules.py
index 07e1da8..f7f5abb 100644
--- a/ldm/modules/encoders/modules.py
+++ b/ldm/modules/encoders/modules.py
@@ -118,7 +118,7 @@ class BERTTokenizer(AbstractEncoder):
         #   BertTokenizerFast.from_pretrained("bert-base-uncased")
         try:
             self.tokenizer = BertTokenizerFast.from_pretrained(
-                'bert-base-uncased', local_files_only=True
+                'bert-base-uncased'
             )
         except OSError:
             raise SystemExit(
@@ -251,10 +251,10 @@ class FrozenCLIPEmbedder(AbstractEncoder):
     ):
         super().__init__()
         self.tokenizer = CLIPTokenizer.from_pretrained(
-            version, local_files_only=True
+            version
         )
         self.transformer = CLIPTextModel.from_pretrained(
-            version, local_files_only=True
+            version
         )
         self.device = device
         self.max_length = max_length
Enter fullscreen mode Exit fullscreen mode
Collapse
 
sjoerdw_bijleveld_38e54 profile image
Sjoerd W. Bijleveld

I had the same problem and your method solved it, but the next error crept up:

Traceback (most recent call last):
Traceback (most recent call last):
File "/Users/SWB/stable-diffusion/scripts/orig_scripts/txt2img.py", line 327, in <module>
main()
File "/Users/SWB/stable-diffusion/scripts/orig_scripts/txt2img.py", line 277, in main
samples_ddim, _ = sampler.sample(S=opt.ddim_steps,
File "/Users/SWB/miniconda3/envs/ldm/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/Users/SWB/stable-diffusion/ldm/models/diffusion/plms.py", line 156, in sample
self.make_schedule(ddim_num_steps=S, ddim_eta=eta, verbose=verbose)
File "/Users/SWB/stable-diffusion/ldm/models/diffusion/plms.py", line 108, in make_schedule
(1 - self.alphas_cumprod_prev)
TypeError: unsupported operand type(s) for -: 'int' and 'builtin_function_or_method'
(ldm) SWB@SWB-iMac stable-diffusion %

For me it is hard to find the reason for this error. Please help!

Collapse
 
frederik_list_e55eb0bd135 profile image
Frederik List • Edited

Hi, thanks for the tutorial, haven't managed to get it to work yet. I got this error:

FileNotFoundError: [Errno 2] No such file or directory: 'sd-v1-4.ckpt'
Enter fullscreen mode Exit fullscreen mode

Edit:
I don't know what I did, but now the error is

FileNotFoundError: [Errno 2] No such file or directory: 'models/ldm/stable-diffusion-v1/model.ckpt'
Enter fullscreen mode Exit fullscreen mode

Edit:
I found the file somewhere else on my mac and put it in the correct folder and renamed it model.ckpt, but it resulted in the following error :

OSError: Can't load tokenizer for 'openai/clip-vit-large-patch14'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-large-patch14' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.
Enter fullscreen mode Exit fullscreen mode

Not really sure how I can proceed from here to try and make it work.

Some other issues I came across along the way:

  • The branch name seems to be apple-mps-support and not apple-silicon-mps-support
  • There is no script named txt2img.py in the /scripts, but there is in /scripts/orig_scripts, however, it doesn't work for me. Is there a new script to replace it? Which one?
Collapse
 
magnusviri profile image
James Reynolds
Collapse
 
nizu profile image
Nicola Zuliani

Thanks for the instructions, but I found some problems while trying to make this to work.
Many modules looks missing on my MacOS (with M1), that I think I managed to install, but now I'm stucked.
The error I get is:

ImportError: dlopen(/Users/nicol/miniconda3/lib/python3.9/site-packages/_dlib_pybind11.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_png_do_expand_palette_rgb8_neon'
Enter fullscreen mode Exit fullscreen mode

Any idea on how to solve it? I tried to install libpng but things don't change.

Thanks again :)

Collapse
 
sjoerdw_bijleveld_38e54 profile image
Sjoerd W. Bijleveld

Hi Craig,
I'm stuck at the point of installing Conda. I get the message: 'zsh: command not found: wget'. It seems wget is a Linux command, but I'm on a iMac (Monterey). Any help is much appreciated!

Sjoerd

Collapse
 
kaolin profile image
ʞɐoןıu ıɯɐƃo ɟıɹǝ

you can install wget with brew, or switch to using curl to get the file also

curl -O URLHERE

Collapse
 
sjoerdw_bijleveld_38e54 profile image
Sjoerd W. Bijleveld

Thanks! ATM I'm not able to try it, but also further investigation revealed that probably the path to the zsh shell is not valid. So I will check that also asap.

Thread Thread
 
sjoerdw_bijleveld_38e54 profile image
Sjoerd W. Bijleveld

It turned out I indeed had to install 'wget' with brew. It does now recognise the command. So no problems with the shell path. Thanks so much!

Collapse
 
gravitide profile image
Aaron Smith • Edited

Are other people having issues with grpcio? I have never delved into the python world much, but tried installing an earlier version into the conda environment and cleared the caches. But it will still download the latest version which fails on my M1 mac.

conda list grpcio
Enter fullscreen mode Exit fullscreen mode

Shows the installed version as 1.42.0 but I still get this error

Collecting grpcio>=1.24.3
  Downloading grpcio-1.47.0.tar.gz (21.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.9/21.9 MB 40.0 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

Pip subprocess error:
  Running command git fetch -q --tags
  Running command git reset --hard -q 24268930bf1dce879235a7fddd0b2355b84d7ea6
  Running command git fetch -q --tags
  Running command git reset --hard -q d50d76daa670286dd6cacf3bcd80b5e4823fc8e1
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/3s/zhffdtdn241f_m_jvjz9qsxw0000gn/T/pip-install-gizrp4u0/grpcio_e54571b9c9134f0a854bb64e8c0605c2/setup.py", line 263, in <module>
          if check_linker_need_libatomic():
        File "/private/var/folders/3s/zhffdtdn241f_m_jvjz9qsxw0000gn/T/pip-install-gizrp4u0/grpcio_e54571b9c9134f0a854bb64e8c0605c2/setup.py", line 219, in check_linker_need_libatomic
          cpp_test = subprocess.Popen(
        File "~/opt/miniconda3/envs/ldm/lib/python3.10/subprocess.py", line 966, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "~/opt/miniconda3/envs/ldm/lib/python3.10/subprocess.py", line 1717, in _execute_child
          and os.path.dirname(executable)
        File "~/opt/miniconda3/envs/ldm/lib/python3.10/posixpath.py", line 152, in dirname
          p = os.fspath(p)
      TypeError: expected str, bytes or os.PathLike object, not list
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

failed

CondaEnvException: Pip failed

Enter fullscreen mode Exit fullscreen mode
Collapse
 
000fff profile image
000fff

I am getting a weird error when I try and run the python script.

I have an apple Macbook Pro M1 with 64GB of ram.


(ldm) thomaspetersen@MacBook-Pro stable-diffusion % curl "https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media" > sd-v1-4.ckpt
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4067M  100 4067M    0     0  63.4M      0  0:01:04  0:01:04 --:--:-- 64.5M
(ldm) thomaspetersen@MacBook-Pro stable-diffusion % python scripts/txt2img.py --prompt "a drawing of web developers" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1
Intel MKL FATAL ERROR: This system does not meet the minimum requirements for use of the Intel(R) Math Kernel Library.
The processor must support the Intel(R) Supplemental Streaming SIMD Extensions 3 (Intel(R) SSSE3) instructions.
The processor must support the Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) instructions.
The processor must support the Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.
(ldm) thomaspetersen@MacBook-Pro stable-diffusion % wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
Enter fullscreen mode Exit fullscreen mode
Collapse
 
constantinez profile image
Constantinez • Edited

thx for this tutorial
but I got error on my MacBook pro (intel):

(ldm) kos@macbook stable-diffusion % python scripts/txt2img.py --prompt "a drawing of web developers" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1
zsh: segmentation fault python scripts/txt2img.py --prompt "a drawing of web developers" --plms --ckp

Collapse
 
kaolin profile image
ʞɐoןıu ıɯɐƃo ɟıɹǝ

The only time I got a segfault was when I set KMP_DUPLICATE_LIB_OK ... I posted a couple other solutions above (recommend the "delete the conflicting library" one over the "rebuild with nomkl" but whichever you feel more comfortable with ^_^ )

Collapse
 
kaolin profile image
ʞɐoןıu ıɯɐƃo ɟıɹǝ

FWIW [2022-08-29] —
on an intel mac

1)
ldm/modules/attention.py#L211 already had the patch

2)
ran into issues with:

Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized OMP:

I wound up redoing the environment to include nomkl and it seems to have worked, if ... so ... SO ... slow [4 minutes!] . But I'll take functional over not (thanks!) ... helps me prep for doing this on a real machine, and I can kick things off overnight. ;)

dependencies:
  - nomkl
...
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kaolin profile image
ʞɐoןıu ıɯɐƃo ɟıɹǝ • Edited

Alternately, with the info that libiomp5.dylib and libomp.dylib were likely conflicts:

 mv /Users/fire/miniconda3/envs/ldm/lib/python3.10/site-packages/torch/lib/libiomp5.dylib /Users/fire/miniconda3/envs/ldm/lib/python3.10/site-packages/torch/lib/libiomp5.bak
Enter fullscreen mode Exit fullscreen mode

seems to have worked, ignoring the nomkl path.

The KMP_DUPLICATE_LIB_OK solution only led to segfaults.

The LD_PRELOAD did nothing, possibly because I was targeting the wrong one, but possibly because the names were actually different?

Collapse
 
unlustucru profile image
unlustucru

Hi and thanks a lot for this tutorial!

I'm getting this error:

RuntimeError: PytorchStreamReader failed reading file data/11: invalid header or archive is corrupted
Enter fullscreen mode Exit fullscreen mode

Any idea what this is and how to fix it?

Collapse
 
stphane_vicent_fb4153cf3 profile image
Stéphane Vicent • Edited

Hi Craig,
thanks for this tutorial.

This step doesn't work for me :

curl https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media > sd-v1-4.ckpt

Enter fullscreen mode Exit fullscreen mode

i get this error :

no matches found: https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media
Enter fullscreen mode Exit fullscreen mode
Collapse
 
craigmorten profile image
Craig Morten

Can you try with quotes around the URL? E.g.

curl "https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media" > sd-v1-4.ckpt
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jeremy_franklin_94c9b39a9 profile image
Jeremy Franklin

I'm getting: I think this has to do with because I tinkered with the cpu/gpu txt2img.py file, does anyone know what I can do?

(ldm) MacBook-Pro-4:stable-diffusion jeremyfranklin$ python scripts/orig_scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms
Traceback (most recent call last):
  File "/Users/jeremyfranklin/stable-diffusion/stable-diffusion/stable-diffusion/scripts/orig_scripts/txt2img.py", line 15, in <module>
    import k_diffusion as K
ModuleNotFoundError: No module named 'k_diffusion'
(ldm) MacBook-Pro-4:stable-diffusion jeremyfranklin$ 
Enter fullscreen mode Exit fullscreen mode
Collapse
 
freemtrg profile image
freem-trg

Hi!
Thank for you for the tutorial!

Now, if I follow the tutorial, I get a problem at the download step "Download Stable Diffusion Weights":
Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object. Permission 'storage.objects.get' denied on resource (or it may not exist).

It looks like this file is now closed or moved. Where can I download the current file?

Collapse
 
robertdm profile image
robert-dm

Hi, I am facing an issue when running the txt2img

(ldm) robert@Robertos-MBP stable-diffusion % python scripts/orig_scripts/txt2img.py --prompt "a drawing of Elon Musk face" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1
Loading model from sd-v1-4.ckpt
Global Step: 470000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Traceback (most recent call last):
File "/Users/robert/Documents/workspace/stable-diffusion/scripts/orig_scripts/txt2img.py", line 319, in
main()
File "/Users/robert/Documents/workspace/stable-diffusion/scripts/orig_scripts/txt2img.py", line 195, in main
model = load_model_from_config(config, f"{opt.ckpt}")
File "/Users/robert/Documents/workspace/stable-diffusion/scripts/orig_scripts/txt2img.py", line 34, in load_model_from_config
model = instantiate_from_config(config.model)
File "/Users/robert/Documents/workspace/stable-diffusion/ldm/util.py", line 89, in instantiate_from_config
return get_obj_from_str(config['target'])(
File "/Users/robert/Documents/workspace/stable-diffusion/ldm/models/diffusion/ddpm.py", line 657, in init
self.instantiate_cond_stage(cond_stage_config)
File "/Users/robert/Documents/workspace/stable-diffusion/ldm/models/diffusion/ddpm.py", line 768, in instantiate_cond_stage
model = instantiate_from_config(config)
File "/Users/robert/Documents/workspace/stable-diffusion/ldm/util.py", line 89, in instantiate_from_config
return get_obj_from_str(config['target'])(
File "/Users/robert/Documents/workspace/stable-diffusion/ldm/util.py", line 99, in get_obj_from_str
return getattr(importlib.import_module(module, package=None), cls)
File "/Users/robert/miniconda3/envs/ldm/lib/python3.9/importlib/init.py", line 127, in import_module
return bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Users/robert/Documents/workspace/stable-diffusion/ldm/modules/encoders/modules.py", line 6, in
from transformers import CLIPTokenizer, CLIPTextModel
File "/Users/robert/miniconda3/envs/ldm/lib/python3.9/site-packages/transformers/
init_.py", line 30, in
from . import dependency_versions_check
File "/Users/robert/miniconda3/envs/ldm/lib/python3.9/site-packages/transformers/dependency_versions_check.py", line 41, in
require_version_core(deps[pkg])
File "/Users/robert/miniconda3/envs/ldm/lib/python3.9/site-packages/transformers/utils/versions.py", line 122, in require_version_core
return require_version(requirement, hint)
File "/Users/robert/miniconda3/envs/ldm/lib/python3.9/site-packages/transformers/utils/versions.py", line 116, in require_version
_compare_versions(op, got_ver, want_ver, requirement, pkg, hint)
File "/Users/robert/miniconda3/envs/ldm/lib/python3.9/site-packages/transformers/utils/versions.py", line 49, in _compare_versions
raise ImportError(
ImportError: tokenizers>=0.11.1,!=0.11.3,<0.13 is required for a normal functioning of this module, but found tokenizers==0.13.0.
Try: pip install transformers -U or pip install -e '.[dev]' if you're working with git main

Collapse
 
apophenian profile image
Rane Bowen

Just a note that the line
git checkout apple-silicon-mps-support should be changed to
git checkout apple-mps-support

Collapse
 
magnusviri profile image
James Reynolds

I'm magnusviri. The instructions should now be modified like so.

git checkout github.com/lstein/stable-diffusion

No need to checkout anything.

Collapse
 
tikkun11 profile image
tikkun11

It worked for a few days, but now when I run the prompt it says:

OSError: It looks like the config file at '/Users/ryan/.cache/huggingface/transformers/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142' is not a valid JSON file.

How can I fix it? I've tried deleting the files in the folder and re-downloading them, but that hasn't worked.

Collapse
 
fredzannarbor profile image
Fred Zimmerman

I was able to get Stable Diffusion running on my Intel chip Mac following these instructions. Thank you! I had to deviate a few times, but these were the best instructions I found for Mac users. I will try to write something up to clarify what steps I took.
Image description

Collapse
 
jeremy_franklin_94c9b39a9 profile image
Jeremy Franklin

Thank you a lot! I don't have much experience coding but I managed to followed this true with some added troubleshooting because I couldn't understand quite all of it. But for now it worked!

I only have one question;

you say: Similarly append a new line x = x.contiguous() after ldm/modules/attention.py#L211

but when I went in the code to append this, it was already there without my intervention or anything. Can I just ignore this step or am I missing something?

It does work without the gpu/cpu thing so thanks again.

Anyway I could buy you a coffee?

Jeremy

Collapse
 
kaolin profile image
ʞɐoןıu ıɯɐƃo ɟıɹǝ

Can I just ignore this step or am I missing something?

I expect the codebase just moved forwards and "fixed" this part :)

Collapse
 
jackdewhurst profile image
Jack Dewhurst

Thanks for this, got it up and running eventually on MacOS 12.0.1 Macbook pro M1 Max.

What sort of speeds are people seeing? It takes around 35 minutes to run the example command to create an image.

Collapse
 
jackdewhurst profile image
Jack Dewhurst

I updated to latest MacOS (12.5.1) and it now takes ~1 minute.

Massive improvement. If anyone else has similar long run times try updating your OS!

Collapse
 
tikkun11 profile image
tikkun11

how do i disable safety mode? i keep getting rick roll'd

Collapse
 
jeremy_franklin_94c9b39a9 profile image
Jeremy Franklin

Do you have to install the Stable Diffusion Weights every time you use it?

Collapse
 
kaolin profile image
ʞɐoןıu ıɯɐƃo ɟıɹǝ

just each time you install stable diffusion :) it'll wind up downloading a bunch of checkpoints/whatnot the first time you run, but won't need to do that either on subsequent runs.