-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
[Bug]: crash when using sdxl loras #15175
Comments
i uploaded my gpu drive, now it reaches the end of progress: To create a public link, set but will still crash after that(means I cant receive the img, though i can see it is gerenated, but it crashed the moment it finished, the eta in webui is like 90%/3s left) |
Can you check in windows event logs for any related messages? Python crash details? Resource exhaustion? |
i already solved it. when I want to load sdxl models, I use --medvram-sdxl, then I restart without --medvram-sdxl and then I can used sdxl models. If I want to load another model, I restart with --medvram-sdxl again and do such thing again. |
That doesn't sound like a solution, but a clunky workaround. The issue still exists if you have to use that |
I have the same issue, but the solution of using --medvram-sdxl then restarting does not solve it for me. The sdxl model works fine on its own, but as soon as I add the lora it crashes. Typically as soon as I try to generate, my computer temporarily locks up, then the ui crashes with this in the console:
Running Linux Mint. Using --no-half --precision full Edit: I confirmed this by using SD 1.5, which is small enough that I can have 2 full copies in memory. Generating with a lora again starts by consuming a bunch of RAM, but stops at about 6gb of additional memory (the lora itself is only 150mb), then everything works and the image generates just fine. I'm guessing that isn't supposed to happen? Shouldn't it either use the model already in memory, or free up that space if it is going to reload the whole thing? |
I can confirm that when using the SDXL model (in my case PonyDiffusion), the RAM consumption increases with every second of generation until it reaches 15.6 GB (I have 16 GB) and the swap file starts to be used. That said, if I use Lora, the RAM gets clogged up after the first generation and it says "Press any button...". I perfectly remember using SDXL model 2 months ago without any problems, I don't remember such RAM consumption. And the error is not on the video memory side of the GPU. Has anyone found a solution? |
I figured out what the problem is. The issue is a RAM leak in the latest version of webui, i.e. during generation the RAM usage grows every second until it reaches the swap file limit. In webui version 1.7.0 there was no such thing. It's just that RAM is at its maximum, it is enough for the first/second generation. But when using Lora, it runs out almost instantly. Apparently there is a bug somewhere that the model is unloaded into RAM at every generation. After downgrading the webui version, the memory leaks no longer occur and the images are generated normally:) Let's wait for fixes, if there are any in the future. You can download version 1.7.0 manually here:: https://github.com/AUTOMATIC1111/stable-diffusion-webui/tree/v1.7.0 @lllyasviel/stable-diffusion-webui-forge#500 (comment) @#15206 (comment) |
I don't think torch 2.1.2 is the only cause of the issue as I am having this same issue with my ARC gpu which uses torch: 2.0.0a0+gite9ebda2 in version 1.8 of the webui. |
sry I cant give any debug logs. I am using google cloud and thus I can get rid of this bug. Just by restart the vm. |
I had similar problem with RAM being filled after each generation when I tried to compare models with x/y/z plot. With v1.8 increasing the number of model loaded into RAM crashing the system after few generations. Memory is allocated after each generation even when model is used from cache. For me using the old settings (obsolate one) for increasing the number of cached models instead the new one fixed the crashes. |
This might be similar to my issues so I will post here instead of making new issue. Events look like this
|
@w-e-w You might want to look at this
|
I notice that the 1.9 release candidate made some changes regarding loras, has anyone tested to see if it's fixed on there? |
I tested SDXL loras with 1.9 and RAM usage still skyrockets to the maximum (32 GB) and then it starts using virtual memory (using up to 20 GB of virtual memory). Only happens when using SDXL Loras. |
Is this with the now-released 1.9? |
Yes, with 1.9 it still has this problem. I'm using --medvram --medvram-sdxl arguments with RX 6700 XT (AMD) |
That's unfortunate. I'd downgrade to 1.7 but that has problems of its own. Could it be related to xformers? Try setting Cross attention optimization to None in Optimizations. |
The following is what I did and it worked wonders. I get the feeling that the last two releases implemented a lot of arbritrary changes which had no justifiable reason to be implemented to a main branch. This include spandrel which has cause major slowdowns for a big part of users(yes you might not see them report here cause non tech savvy users get put off being requested to spend an hour learning how to properly submit an issue). I suspect they missed reading the full changelog for Torch releases 2.1.0-2.1.2 in regards to weights and multiple devices (in this case their odd loading between cpu and gpu) Instructions:Downgrade to 1.8.0Install CUDA toolkit 11.8Install cudnn"extract respective files into CUDA installs bin,include and lib\x64 folders" Click windows search barand type environment then click "Edit system environment variables" in results and in next window that pops up. Editing variablesIn the lower part check that you have CUDA_PATH set to same as CUDA_PATH_V11_8 and add one named CUDNN and give it the variable(assuming you install instandard location. edit the following if different)
After all this is done Reboot your PC once.Open your webui root folderOpen Powershell and acitvate the venv
Then install torch 2.0.1 for cuda11.8
Install xformers 0.0.22
Lastly do check just in case there is something important that conflicts but there rarely is.
Open webui-user.bat in text editor and add --skip-install just in case. Hope this works. Will try to check back later to see if all went well |
Noticed that this memory leak is not triggered during X/Y/Z script runs |
Ok i may have a workaround that limits the amount of crashes, while using Kohya i had the same issue an it resolved both, Disabling system memory fallback helps by stopping the gpu from dumping the excess of VRAM into RAM (it might even speed up your 1.5 gens if you havent done it in the past) https://nvidia.custhelp.com/app/answers/detail/a_id/5490/~/system-memory-fallback-for-stable-diffusion |
Running X/Y/Z plot script actually clears out the VM |
You're supposed to do that for SD regardless of this bug, especially with 8gb VRAM or less |
Sure but OP and i both had crashes as well as the memory leak hence why i shared it, two problems in one sort of things. I experienced way less issues with the fix. |
My webUI stopped hanging up when I removed the |
I use Intelligent standby list cleaner (ISLC). 8gb VRAM, 32gb RAM. I can generate for about 20-30 mins before crashing with medvram-sdxl and xformers. |
So it's a massive problem. We should do something about it and draw the contributors attention to it. |
I've been facing the same exact problem for weeks now. I was able to use XL loras before with no problems and now it crashes my entire system even if I use it only once. It will go through the first gen but if I try to generate other images, it slowly freezes my computer even when not using loras. Very annoying. I'm using a GTX1080 on Arch Linux. Latest drivers, latest webui, --medvram-sdxl flag. |
Just adding myself in as well with this problem. Same boat, was able to use it fine, but can't use it anymore. |
In case people are still having this problem on Auto, I managed to use loras with Forge (https://github.com/lllyasviel/stable-diffusion-webui-forge). It's basically auto but much faster. It's apparently been abandoned but for what I do it works just fine. I can use multiple loras at the same time with no problems. There's an asterisk however. If I try to swap >checkpoints< in a session it still freezes my system so there's that. |
Thanks for the suggestion! I've been watching this thread hoping for a fix, but until then it's nice to have another option. |
This is getting buried when it's a severe issue. Desperation time. I apologize in advance: |
Please set environment variable |
Tell me what commands to execute on the crash dump. I don't want to share it.
|
There is a high chance that I need more than it. Let's wait until someone shares. |
Is there any way I can share it privately? |
There is a discord channel on the wiki, if you want to join. |
I don't see any discord mention on A1111 wiki. However, I am on the stable diffusion discord. I don't see your (wfjsw) nickname there though. |
https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Contributing It is hidden deep for some reason. |
After the latest webui update I can confirm that the memory leak is fixed, the system does not consume more than 20-25gb of RAM when generating using LoRA and does not crash with an error. |
What latest update? What branch? |
|
modules/models/sd3/sd3_model.py
Isn't this only for SD3?
…On Wed, Jul 3, 2024 at 8:16 AM Nikolay L. ***@***.***> wrote:
After the latest webui update
What latest update? What branch?
9e404c3
<9e404c3>
—
Reply to this email directly, view it on GitHub
<#15175 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGBCKPHCBJVHDS5QMD3IA6LZKPTSPAVCNFSM6AAAAABELRFZX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBVHEZTSMRRGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This update also extended to the main webui. At least my branch was updated when I started webui and the memory leak stopped when I used --medvram |
There haven't been any commits to the master branch since May 28, 2024. Last update on a branch was 4 days ago. |
Yes, that's correct, and yet my webui got the updates when running with the git pull command. |
git checkout'd back to master and did a git pull. I can confirm that SDXL models no longer use 24+GB of my ram whilst idle and try to crash my system on execute. And SD1.5 uses a 'mere' 10GB compared to the 18 it kept trying to allocate to. But I also now am completely unable to switch models due to new cuda memory errors.. And SDXL fails to complete due to "Press any key to continue..." at 100% which event viewer points to an error in c10.dll. #15430 |
Sounds like there might've been a dependency change. Could you list the output of |
I upgraded from 8 to 16 VRAM and removed the medvram-sdxl flag from the launcher command. I run git pull on every launch. I can still reproduce the memory issue with or without loras by running 1 batch gens (batch size 4-8) on them on different models. |
|
Checklist
What happened?
if i use sdxl loras, webui will crash.
Steps to reproduce the problem
1.run webui.
2.run a txt2img with sdxl model and lora
3.crash
What should have happened?
successfully return the img
What browsers do you use to access the UI ?
Microsoft Edge
Sysinfo
sysinfo-2024-03-07-18-39.json
Console logs
Additional information
it is weird, beacuse I can run sdxl with loras before.
In some day I suddently cant load sdxl models (pytorch allocated 10.6G which is much more than before), so I add --medvram-sdxl. Now I can load sdxl models, but I still cant use loras.
The text was updated successfully, but these errors were encountered: