-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Can't finetune stable diffusion with --enable_xformers_memory_efficient_attention #2234
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
Comments
@LucasSloan There's a good chance your issues are related to a problem in xformers v0.0.16 where the Stable Diffusion attention head dims are too large on certain GPU architectures (sm86/89): Try updating to a newer xformers dev release that includes the patch from that issue: If that doesn't work, would you mind sharing the output from |
That fixed it, thanks! |
Hey, I stumbled upon your response while trying to fix my own issues with xformer 0.0.16, however all of the dev options that you suggested provided errors (base) C:\Users\orins\OneDrive\Documents\SDlocal>pip install xformers==0.0.17.dev441 Since I assume it will be helpful, I will also provide the python -m xformers.info (base) C:\Users\orins\OneDrive\Documents\SDlocal>python -m xformers.info Hope this is enough info, thanks |
Hi,
TL;DR If you read the error from the attempted install, you'll see xformers version 0.0.17.dev441 is no longer available on PyPi. Instead, try installing one of the newer dev releases which should include the fix:
0.0.17.dev447, 0.0.17.dev448, 0.0.17.dev449, 0.0.17.dev451, 0.0.17.dev461
See for PyPi for all releases: https://pypi.org/project/xformers/#history
You may wonder: why doesn't the version I posted exist anymore?
Answer: All libraries have limited space available to them on PyPi to host different versions. They keep stable versions pinned, but as new development releases of the upcoming version are made available, they have to deprecate older minor dev releases to stay within their quota.
Best
Evan Jones
Website: www.ea-jones.com
…On Mon, Feb 20, 2023 at 10:03 PM Dragonswords102 ***@***.***> wrote:
Hey, I stumbled upon your response while trying to fix my own issues with
xformer 0.0.16, however all of the dev options that you suggested provided
errors
(base) C:\Users\orins\OneDrive\Documents\SDlocal>pip install
xformers==0.0.17.dev441
ERROR: Could not find a version that satisfies the requirement
xformers==0.0.17.dev441 (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5,
0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.16rc424,
0.0.16rc425, 0.0.16, 0.0.17.dev447, 0.0.17.dev448, 0.0.17.dev449,
0.0.17.dev451, 0.0.17.dev461)
ERROR: No matching distribution found for xformers==0.0.17.dev441
Since I assume it will be helpful, I will also provide the python -m
xformers.info
(base) C:\Users\orins\OneDrive\Documents\SDlocal>python -m xformers.info
Traceback (most recent call last):
File "C:\Users\orins\miniconda3\lib\runpy.py", line 187, in
_run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\orins\miniconda3\lib\runpy.py", line 110, in
*get_module_details import(pkg_name) File
"C:\Users\orins\miniconda3\lib\site-packages\xformers_init*.py", line 10,
in
from . import _cpp_lib
File "C:\Users\orins\miniconda3\lib\site-packages\xformers_cpp_lib.py",
line 127, in
_build_metadata = _register_extensions()
File "C:\Users\orins\miniconda3\lib\site-packages\xformers_cpp_lib.py",
line 117, in _register_extensions
torch.ops.load_library(ext_specs.origin)
AttributeError: module 'torch' has no attribute 'ops'
Hope this is enough info, thanks
—
Reply to this email directly, view it on GitHub
<#2234 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ2T6AN3RZY7PVOUMFQOIQDWYQWANANCNFSM6AAAAAAUQT2EKM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
It appears you actually only have 6GB of VRAM on your GPU which is probably
too limited for training most image models unless you run an extremely
optimized algorithm.
Anyways, if you have questions about Auto1111 webUI, I would take your
questions over there.
Best
Evan Jones
Website: www.ea-jones.com
…On Fri, Feb 24, 2023 at 3:51 AM Dragonswords102 ***@***.***> wrote:
Hi, that seemed to fix my issue, thank you. While we are here I have
another issue that maybe you have knowledge on. I have created a
hypernetwork and followed a GitHub guide on training settings, however when
I press train hypernetwork, the command prompt tells me that cuda is out of
memory, which does not make much sense to me as I have plenty of space. I
have 16gbs of RAM and about 128MB of VRAM
[image: false error]
<https://user-images.githubusercontent.com/125940602/221134518-52d4df32-0033-4ff9-9e67-62bb62354f9d.png>
—
Reply to this email directly, view it on GitHub
<#2234 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ2T6APGTLGZH76NZSJNKWDWZBZCFANCNFSM6AAAAAAUQT2EKM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
issue ERROR: Could not find a version that satisfies the requirement xformers==0.0.17.dev441 (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.16rc424, 0.0.16rc425, 0.0.16, 0.0.17.dev466, 0.0.17.dev473, 0.0.17.dev474, 0.0.17.dev476, 0.0.17.dev480, 0.0.17.dev481)
|
Hey @technologiespro , This looks like a problem with xformers: https://github.com/facebookresearch/xformers - could you please post the issue there? |
Hi everyone, I encountered the issue while training my Dreambooth model and found a solution that may be helpful to you.
After making these changes, you should be able to start training your Dreambooth model. For your information, I am using Windows10 as my operating system and a 3060 GPU. Additionally, I came across some information at (https://huggingface.co/docs/diffusers/optimization/xformers) that suggests xFormers v0.0.16 may not be suitable for training (fine-tune or Dreambooth) on certain GPUs. If you encounter any issues, please refer to the comment on that page and install the recommended development version to test whether it resolves the problem for you all. |
I encountered the issue while running python -m xformers.info: |
How do you solve this problem, which version of xformers you have installed? I try 0.0.17. 0.0.17rc481. 0.0.17rc482, but cannot solve this problem. |
Do you solve this problem finally? |
hi ,I have encountered the following problem,torch==2.3.0+cu118 and xformers==0.0.26 post1+cu118 return self.call_impl(*args, **kwargs) |
I'm Trying to install xformers in Pycharm with Torch 2.5.1 already installed and I always get "No Torch Module found". I tried installing 0.0.30.dev967, which is the latest version I can see to no avail.
|
Describe the bug
I'm trying to finetune stable diffusion, and I'm trying to reduce the memory footprint so I can train with a larger batch size (and thus fewer gradient accumulation steps, and thus faster).
Setting
--enable_xformers_memory_efficient_attention
results in numeric instability of some kind, I think? The safety_checker tripped (training on the Pokemon dataset, validation prompt "Yoda"). If I disable the safety_checker, and I get black images anyway, along with the error message:If I instead set
--enable_xformers_memory_efficient_attention
, but disable--gradient_checkpointing
, everything hums along nicely, but the model doesn't actually fine tune.I attempted to force xformers to use Flash Attention (using the snippet in #2049), because #1997 suggested there were issues with the other xformers attention kernels, I get this error:
Reproduction
Here's the command I ran with
--enable_xformers_memory_efficient_attention
, but not with--gradient_checkpointing
:I'm running with #2157, because that gives me images to see how training is progressing (which is how I noticed it wasn't finetuning), but I've observed it at HEAD.
Logs
No response
System Info
diffusers
version: 0.13.0.dev0The text was updated successfully, but these errors were encountered: