Live data from Hacker News

Run Stable Diffusion on Your M1 Mac’s GPU

replicate.com

391–400 of 415 posts

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#392
post #368
post #78

Earlier quoted context omitted.

It isn't required for some (most?) users. Weirdly sometimes pip is picking up the wheel for `onnx`, sometimes it isn't, and we can't figure out why. Any Python packaging experts know what's going on? all macOS 12, arm64, Python 3.10. Can't think it wouldn't resolve the wheel. But yes, good idea to move up. I'll stick it next to the `pip install`.

Please consider also adding a small note to help those few that get stuck with this bug: RuntimeError: expected scalar type BFloat16 but found Float The solution is easy: append the execution command with `--precision full`

Commenting for visibility, thanks for this

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#393

Earlier quoted context omitted.

I ran into: ImportError: cannot import name 'TypeAlias' from 'typing' (/opt/homebrew/Caskroom/miniconda/base/envs/ldm/lib/python3.9/typing.py)

I ran into this. You need Python 3.10. I had to edit environment-mac.yaml and set python==3.10.6 ...

I changed the dependency to 3.10.4 (tried 3.10.6 as well), installed python 3.10.4, deactivated and activated ldm environment, but it still uses python 3.9

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#394

I keep getting `No module named 'ldm'` after I run `python scripts/dream.py --full_precision`. I've confirmed 'ldm' is activate in conda. Any idea?

I get the same thing too!

Try to put `sys.path.insert(0, os.getcwd())` after `import sys` in dream.py.

That fixed it for me.

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#395

Everyone posting their pip/build/runtime errors is everything that's wrong with tooling built on top of python and its ecosystem. It would be nice to see the ML community move on to something that's actually easily reproducible and buildable without "oh install this version of conda", "run pip install for this package", "edit this line in this python script".

Looking through the top level comments, there are only 2 like that and they are about build errors in dependent native libraries written in other languages, which is not really the Python ecosystem's fault (as the author has chosen not to distribute prebuilt stuff).

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#396

Earlier quoted context omitted.

I ran into this. You need Python 3.10. I had to edit environment-mac.yaml and set python==3.10.6 ...

I changed the dependency to 3.10.4 (tried 3.10.6 as well), installed python 3.10.4, deactivated and activated ldm environment, but it still uses python 3.9

Can you delete your environment and try again?

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#397

Earlier quoted context omitted.

I changed the dependency to 3.10.4 (tried 3.10.6 as well), installed python 3.10.4, deactivated and activated ldm environment, but it still uses python 3.9

Can you delete your environment and try again?

Thanks, it worked

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#398

Earlier quoted context omitted.

I changed the dependency to 3.10.4 (tried 3.10.6 as well), installed python 3.10.4, deactivated and activated ldm environment, but it still uses python 3.9

Can you delete your environment and try again?

Since I don't know how to use conda, I had to struggle a bit to learn how to recreate the environment. Here's the commands that worked me for future reference:

  conda deactivate
  conda env remove -n ldm
Then, again:

  CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac.yaml
  conda activate ldm

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#399
post #321

Earlier quoted context omitted.

I think it is fair, actually. This is not unique to hours-old python projects, it's a common theme among almost all python tools I've used. I have a suspicion that that something written in Julia, Go, Rust, or possibly even C wouldn't have nearly this many issues. I'm not talking about debugging the actual functionality of the software, but rather the environment and tooling surrounding the language and software buil…

Yes there is a fair amount of truth in that. I do think that experience helps here. I have a recipe for installing Python that works on most python projects most of the time. git clone python3 -m venv ./venv source ./venv/bin/activate pip install -r requirements.txt deactiviate # need to do this to include the correct command line tools in path (eg Jupyter) source ./venv/bin/activate Done. On a Linux or Intel Mac sys…

Also, sorry to double post, but you don't actually need to activate the venv. You can just invoke `venv/bin/pip`. That should hopefully save you a bit of time and annoyance.

Re: Run Stable Diffusion on Your M1 Mac’s GPU

#400
post #28

Earlier quoted context omitted.

I got stuck on this roadblock, couldn’t get CUDA to work on my Mac, was very confusing

Didn’t apple stop supporting Nvidia cards like 5 years ago? How could it be confusing that Cuda wouldn’t run?

Ah, I didn't realize. It's not very obvious what GPU you have in your Macbook, I couldn't actually find out where to find that in my System settings. On Windows it's inside the "Display" settings but on MacOS... where is it? :)
Post reply on HN