-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M1 issues (multiple) #1135
Comments
I'm having the same issue with performance |
Hi, the instructions and install script have been updated. Could you try the latest changes and see if it's any different?
This is expected and not a bug. The warning has no impact on the performance of images being generated - for more information read: pytorch/pytorch#80278 (comment) |
Thank you for your support, I reinstalled via instructions on https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon Seemingly runs and installs, however upon completion the auto-run returns this error: Warning: LDSR not found at path /Users/[me]/Documents/stable-diffusion-webui/repositories/latent-diffusion/LDSR.py Cleaned up and re-installed and got the same. Manual launch with python webui.py also fails with same error. Running run_webui_mac.sh I get the following: The PYTORCH_ENABLE_MPS_FALLBACK variable is not set. So I follow those instructions and run_webui_mac.sh again: WARNING: overwriting environment variables set in the machine (web-ui conda environment is activated) Tried python webui.py again but still returns that same error after installation / auto-run. Thanks. Jon |
That's odd.
This indicates that the dependencies either didn't get installed, or did get installed but not in the right environment. The other warnings/failures seem to be because I screwed up the checks in the Could you try Thanks! |
You mean as per the instructions? $ cd ~/Documents/ That's what I did previously (Sorry the terminal isn't my natural habitat) Edit: Sorry think I'm missing your intent... you just want me to do it again in order to get the full log? Anyway, will reinstall and get back |
Full [failed] install log... |
I tried this and it failed for me. First therewas no run_webui_mac.sh file in the stable-diffusion-webui folder. I copied the old one but then got the failure of a lack of models `(base) user@Mac-Studio ~ % cd ~/Documents/ Remove all packages in environment /Users/user/miniconda/envs/web-ui: Package Planenvironment location: /Users/user/miniconda/envs/web-ui The following packages will be REMOVED: bzip2-1.0.8-h620ffc9_4 Proceed ([y]/n)? y Preparing transaction: done ==> WARNING: A newer version of conda exists. <== Please update conda by running
Package Planenvironment location: /Users/user/miniconda/envs/web-ui added / updated specs: The following NEW packages will be INSTALLED: bzip2 pkgs/main/osx-arm64::bzip2-1.0.8-h620ffc9_4 Proceed ([y]/n)? y Preparing transaction: done To activate this environment, use$ conda activate web-uiTo deactivate an active environment, use$ conda deactivateCloning into 'stable-diffusion-webui'...
|
Mac M1 here. Getting the same:
Always the same LDSR error and black image. Full Error:
|
Good catch, fixed. As mentioned on the wiki, the only 2 samplers that work (for me, but I'm pretty sure it's for everyone running Apple Silicon) are Euler and DPM2. Are you testing with these 2? Aside from that, I don't include the LSDR repo since it also didn't work (for me), and upscaling with REAL-ESRGAN felt good enough. EDIT: I've just tried a completely clean reinstall using the script and it seems to work fine for me - I'm not sure what the issue is that's causing the repositories not to be cloned correctly... |
Mac M2 here. Library loading issue. Same as others above.
|
Could someone having these issues join the Stable Diffusion discord and tag |
Just did. |
@dylancl my bad, I missed the sampeling method caveat for Apple Silicone, that actually did the trick. |
I've got an idea of what's causing your issue, I think you're not in the web-ui conda environment (which is where the packages get installed) You've got (a) previous installation(s) of Anaconda, and perhaps Python which is most likely causing the issue. |
I followed this and solved the issue. Thanks! |
Thanks so much Dylancl - sounds like could well be it! Machine is currently tied up doing textual inversion with invoke but will try when it eventually finishes. Does this mean having both invoke and webui forks on my system is not workable? |
No, but it's important to keep the environments completely separate. InvokeAI creates the environment The best thing to do now would be to just have 1 installation of Python and 1 installation of Miniconda - this will prevent a lot of issues that seem to appear when having multiple installations of Python and/or Miniconda. |
I had been ensuring I was in the correct environment and both environments were in miniconda3/envs (even though my webui install created a miniconda dir). Sounds like there could well be some conflict going on though. Anyway, will wipe all and start from scratch. Will return with results. Thanks again. |
Hey @dylancl - I'm still running into problems. I believe I've uninstalled python / anaconda but the install is failing I think when conda activate / deactivate is required because a terminal restart is required? Full log: https://gist.github.com/Homemaderobot/4c2f35df238a6bbad5d9b26ba8035b69 So I go through the last install steps manually and then getting the following... Warning: LDSR not found at path /Users/jonathansykes/Documents/stable-diffusion-webui/repositories/latent-diffusion/LDSR.py Full log here: https://gist.github.com/Homemaderobot/0eeabade880368343b70bdd7b5089da2 |
@Homemaderobot LDSR is not a hard requirement, but k_diffusion is imported in the webui script. You can fix this by cloning the repo to the expected directory or by adding it in the installation script (setup_mac.sh). For example, add this in line 76 of the script: |
It worked! Thanks so much @victorca25 and @dylancl for helping me out. Even better I've got Invoke running as well with seemingly no issues. Performance is still an issue though (as per my first post in the thread). With the following settings: Txt2Img / 20 step / Euler / 1 iteration / 7 CFG scale - I'm consistently getting a generation time of 91 secs (compared to just 15 seconds with Invoke with exact same settings). Any thoughts on why that might be? I do get a warning about 'aten::frac.out' not being supported: txt2img: an astronaut on a horse (GPU does seem to be maxing out looking at GPU history.). |
I've updated the installation instructions to include this repo, but IIRC wasn't this normally included as a submodule in the 4 previously cloned repositories? 🤔 Either way, fixed. |
@Homemaderobot try my fork of k-diffusion; I wrote a GPU implementation of Tensor#frac(), and a few other fixes for M1. Whilst I've not tried every sampler: I confirm that Heun, Euler and Euler ancestral work (I fixed the black image problem). |
If you're seeing speed issues: are you using PyTorch nightly? There was a 6x perf regression introduced a few days ago: Even overlooking that recent issue: generally nightly is 5~6% slower than stable right now, even though it supports more operations on-GPU: |
can the installer just be more simpler.... |
The check for the models & required repositories has failed. |
i just had the you cant find model and repo issue again... this is what i meant why it wasnt easy to install the way i managed to make it work, was by using this this worked in installing perfectly, but i had to add k-sampler by myself..and it was slow, Now with this new update. It cant find the models nor repos |
I would need to see the log of the install, the errors during install are pretty clear in that they explain exactly what's wrong, in this case either the modal not being in the correct location or some of the repos not being cloned. |
it doesnt say error.. it just cant find them,
But like i said... it works with the |
I also just figured out that you put the checkpoint file in the models directory since that is where it downloads the file to, and then later in the process it moves it into the Stable-Diffusion directory. Is this correct? |
yeah ur supposed to put it in there and it should work on from there, but for somereason it isnt working... i made it work with an older fork... not this new though, attempt to rewrite the old one with the new updates. |
You're selecting |
yes |
Are you sure? Since the script deletes the previous |
Are you sure? Since the script deletes the previous im 100% sure, anyways I just fixed it. by using the 6-day-old scripts and just adding the k-sampler and PyTorch update you just did it works perfectly. i think something about the new script doesn't work for everyone. it now works and its much faster with the new pytorch fix. ACTUALLY nvm... im getting a black generated images.. hmmm. i think its the pytorch update... cuz it worked before actually nvm nvm... it now works? im so confused.. my first image was black and now they arent black anymore lol. |
copying the checkpoint file into the models directory and letting the script move it worked for me. |
for me for some odd, reason it didnt work when i tried that. but anyways got it working |
I did get this error? note: This error originates from a subprocess, and is likely not a problem with pip. something to do with GFPGAN? Any ideas how to fix that? |
I finally got it to run - BUT after checking out https://github.com/TheLastBen/fast-stable-diffusion I feel sad to go back to those slow local speeds.... any way to include those changes for m1 Macs? the speed increase in the colab is insane! |
anyone now how to make the webui available on a local network? I see the command line arguments but can't seem to make them work on M1? |
this would be amazing cuz even with the pytorch fix still takes 30 seconds for 20sample image |
@Maki9009 I don't think it's straightforward to port those optimizations to Mac. Flash attention takes advantage of how to efficiently use the I/O of the GPU, which means it's programmed natively in CUDA. for M1 we would need somebody to write an implementation from scratch in Metal or Metal Performance Shaders. well, I think lucid has an implementation that just uses PyTorch operations, but I don't know that it's faster. that could be worth checking. |
@Birch-san Thanks for the explanation - a bit sad though! :) |
we need an ai that figures out how to port stuff. |
Hi, I just got a new M2 Mac and this webui is approximately 3x slower for me than Diffusion Bee out of the box. Are there any optimizations that they do that I perhaps have to turn on? I would love to play with all these features, but it's just so much slower on the same hardware :/ I have a MB Air M2 16 GB The Mac is passively cooled and gets a bit hot and I didn't save any timing info from earlier runs, but I'm getting approximately 16s per iteration in this current run (I'm running a text prompt file with prompts I enqueued), which is pretty terrible... I read on the invokeAI website that Apple Silicon users should enable full precision for example. |
@tensojka did you run the latest version of the installation script? This downgrades the PyTorch version to a previous one that doesn't have the performance regression. I ran a bunch of prompts today and getting great speeds: |
@dylancl I installed it a few days back and got to playing with it only now. How do I update? Do I have to reinstall it completely? It says this on startup: WARNING:root:Pytorch pre-release version 1.13.0.dev20221001 - assuming intent to test it (Speeds did not improve much after letting the laptop cool down) |
@tensojka Also, since Apple Silicone is so well optimized it never reaches temperatures where it starts throttling when using Stable Diffusion, so it's not something you need to worry about 😄 |
I also reinstalled the M1 version with the newest script. my 512x512 speed is perfeect (1.58 s/it) but as soon as you change the resolution to 512x1024 the it/s drops significantly to 18.36 s/it.
|
I finally got this script working. I had to do a few things and maybe others have a similar situation to me. I had transferred everything from my old intel mac to my new m1 mac which copied over |
Error while inpainting on M1 with "restore faces" option activated.
|
Closing this issue since the OP's issue has been solved. Please create a new issue for any future problems you run into. |
@Maki9009 , what performance do you get in your Mac Studio, and what config does it have? |
Am new to SD web ui, looks awesome but had issues installing on my M1 Max 32GB, and also a performance issue which I think could be bugs.
As others have noted, following the installation instructions on https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon by running curl -s https://raw.githubusercontent.com/dylancl/stable-diffusion-webui-mps/master/setup_mac.sh just prints in the terminal window.
and https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/setup_mac.sh gives a 404
So I ran https://raw.githubusercontent.com/dylancl/stable-diffusion-webui-mps/master/setup_mac.sh locally. This ran but terminates early after installing the repositories, with this error:
ERROR
The check for the models & required repositories has failed.
Please check if the model is in place and the repos are cloned.
You can find the model in stable-diffusion-webui/models/sd-v1-4.ckpt
You can find the repos in stable-diffusion-webui/repositories/
ERROR
[model and repos are all in place from what I can tell].
I tried the .sh installer here dylancl@f78c018 which ran OK, to completion, and launched web ui. Great, however...
... with these settings: Txt2Img / 20 step / Euler / 1 iteration / 7 CFG scale ... it takes 91 seconds (4.28 s/it)
and I get this message in the terminal...
/Users/[me]/miniconda/lib/python3.9/site-packages/k_diffusion/external.py:71: UserWarning: The operator 'aten::frac.out' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/mps/MPSFallback.mm:11.)
With exact same settings + prompt on my M1 using InvokeAI, it takes just 15 seconds (6 times faster). I'd guess the GPU isn't being used for me with webui?
When I finish my session, I get this error:
Interrupted with signal 2 in <frame at 0x2b2a36cf0, file '/Users/[me]/miniconda/lib/python3.9/site-packages/gradio/blocks.py', line 1249, code block_thread>
(base) MacBook-Pro-2:~ [me]$ /Users/[me]/miniconda/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
Then when I try and re-launch it fails and I get this...
WARNING: overwriting environment variables set in the machine
overwriting variable PYTORCH_ENABLE_MPS_FALLBACK
Already up to date.
Warning: LDSR not found at path /Users/jonathansykes/stable-diffusion-webui/repositories/latent-diffusion/LDSR.py
Traceback (most recent call last):
File "/Users/[me]/stable-diffusion-webui/webui.py", line 8, in
from modules.shared import opts, cmd_opts, state
File "/Users/[me]/stable-diffusion-webui/modules/shared.py", line 5, in
import gradio as gr
ModuleNotFoundError: No module named 'gradio'
... a reinstallation gets it running again, but get exact same results i.e. runs OK once, then dies.
I do have InvokeAI installed too - could that be an issue or is it something else?
Thanks! Jon
The text was updated successfully, but these errors were encountered: