-
Notifications
You must be signed in to change notification settings - Fork 5.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
Issue running stable diffusion dreambooth on mac m3 max apple silicon. #7498
Comments
Hi @sagargulabani, |
yes, that is true. The issue is related to the webui.
My peft version is 0.7.0 and this is my command to run
|
I did run it by removing the dora flag from the script. [here] (
After that I ran into the following issue.
|
You should remove "mixed_precision="fp16"" when using M3. Cc: @bghira |
And yes #7447 should be helpful. |
Hi @sayakpaul , I did remove that and run but it looks like the code gets stuck
Its not progressing beyond this. also I had to remove
|
So I figure that is moving, but it is extremely extremely slow.
Any suggestions to make it faster. |
are you on 14.4? i've been using pytorch 2.2 and i get about 10 seconds per step with 1 megapixel images on a M3 Max 128G. do you observe any memory / swap pressure? |
also, in my environment, i've been running with the code only returns an error to the user when mixed_precision="bf16", informing them to use fp16 instead. the default is actually fp32, which seems to be in use here hence the extreme slowdown. the goal should be to ensure that mixed_precision=fp16 works on mps. the relevant section from the linked PR: # Some configurations require autocast to be disabled.
enable_autocast = True
if torch.backends.mps.is_available() or (
accelerator.mixed_precision == "fp16" or accelerator.mixed_precision == "bf16"
):
enable_autocast = False disables autocast on MPS. wasn't sure whether the initial report included that PR or not. if it didn't, could you re-attempt with |
so this is the error I see when I run in it with mixed precision fp16
yes I am on Mac OS Sonoma 14.4, just upgraded it. |
are you running the latest main branch? |
yes, I took a pull yesterday. I also took a pull right now - 34c90db (this is the commit) did run and after that also getting the same error. This is what my pip list command for diffusers shows. |
#7530 might fix this one @sagargulabani |
Hi @bghira and tried to run the same command above with the same script - train_dreambooth_lora_sdxl.py
|
@sagargulabani i've updated that script in particular for that PR. it now uses native_amp = False in the Accelerator config. can you please re-run with that change? i will put it to the rest of the scripts after |
@bghira I've been having the same problem as @sagargulabani and your new changes with explicity disabling native amp leads to a different error type:
edit: script parameters (pytorch 2.2.2)
|
was there more to the traceback before that one? that's the traceback from Accelerate, but the one from the trainer is needed to know where this error originated. i believe it's in log_validations where the dtypes change. this is something i saw when also updating to pytorch 2.2 latest. i'm really hoping we don't have to run |
@sayakpaul i think i'm in a bit of a need of rescuing on this issue. do you have an ideas how to proceed? maybe a dummycast wrapper in train utils as i mentioned last week? the dtypes have to be the same everywhere for MPS. |
This is the full log, I can't see anything more useful:
|
Hi @bghira, I also see the same error as @akospalfi |
i'm able to reproduce this one locally, but it's not clear why it's happening. the text encoder hidden states are fp16, the noisy inputs are fp16. i can train locally on SimpleTuner, which handles dtypes differently, but it's not clear which difference is causing this problem. |
Hi @bghira @sayakpaul |
it's been complicated to do in a non-invasive way for the diffusers project. for now, i've been running dreambooth via simpletuner for the last few days successfully, introducing single subjects via these config values on pytorch 2.4 nightly. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
not stale, just waiting on some pytorch improvements |
we can close this now that pytorch supports mps ? |
Have you verified if it runs successfully? |
no I haven't verified it. Will verify and let you know. |
well, no. it's not even in a release yet :-) |
and it was now reverted out of pytorch/main due to regressions :[ |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
@sagargulabani does this work now? |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Closing due to inactivity. |
Describe the bug
I am trying to run dreambooth stable diffusion on m3 max.
However I am running into an issue because of which whenever I am trying to generate the class images for the concepts, it fails.
Reproduction
To reproduce the errors, try to setup dreambooth extension of m3 max apple silicon.
Then try to generate class images. It will fail.
As per this issue, someone suggested us to open an issue in this respository.
Please help us. Thank you.
Logs
System Info
Apple M3 Max 30 CPU 40 GPU, 16 inch, 48 GB of RAM.
Python version - 3.10.14
diffusers - 0.27.2
transformers - 4.30.2
torch - 2.1.0
Who can help?
@Sayakp
The text was updated successfully, but these errors were encountered: