-
Notifications
You must be signed in to change notification settings - Fork 358
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
Lora broken output #242
Comments
same here, I just commented the lines added on this commit and it works fine again |
Can you provide lora examples? |
Any LORA i've tried with sdxl atleast i don't have any base models downloaded. But you can try the sdxl lightning 8 step lora I did a simple prompt of just "mountains" |
Without fix:
With fix I do get an image with broken colors (mostly black), but without fix there is no image at all. |
Wouldn't skipping n_dims of 0 skip scalars. I'm not extremely versed with machine learning, so i could be wrong |
Not really important here, because GGML will generate error, so we cant use n_dims = 0. Strange you are getting results "before", are you sure you applying lora? |
Yeah they are definitely being applied correctly i tested with the python version and got the same result as with cpp version, after that check was added its only a black image with artifacts now |
If you want me to test this, I do need minimal example to reproduce your error:
|
For testing purposes i'm using this setup: Versions i tested with |
On master-6d16f68 I do still getting a GGML error. |
That's really odd, im running on windows with cuda are you on a different OS/hardware maybe? |
I am running sd.cpp as a lib, on linux/cuda. I do not think this is important, code is the same, as I can see. The strange part is that you do not get error on earlier versions. My fix does not do anything special, just don`t safe to memory tensors which we cant use anyway. In case this fix is do something wrong - you get broken image (black stuff). In some tests it help to run loras without problems. But before fix you must get error message from GGML. |
I had the same issue and solved it by commenting out the changes in #233, I suspect this is due to the LoRA alpha scalars having a dimension of zero. Edit: #263 |
I still cant reproduce the error. |
CPU back-end without any extra compilation arguments, using most recent commit ce1bcc7. Happens with every model and lora combination I've looked at, both SD1.5 and SDXL. My fix addresses the problem by not doing the dims check for alpha tensors as those are expected to be scalars. |
Updates: So for most LoRAs skipping the "alpha" scalars doesn't seem to matter. That said, when using certain LoRAs, such as the SDXL 8-Step Lightning LoRA mentioned above in gartia's comment, it does make a difference. With the fix it works fine, without it garbled noise is produced instead. It's also worth noting that I don't get GGML errors either way. You can find the LoRA here if you want to try to replicate my results and don't want to make a civitai account: Here's the invocation I used, only changing if the fix was applied: |
The issue arose due to my mistaken merge of #233. I believe it has been fixed in the latest commit. |
@grauho In Release mode, assertions are disabled during compilation, which is likely why you couldn't reproduce the error. I believe most people compile in Release mode, so they wouldn't encounter the issue.
|
Doesn't seem to be fixed, at least for me. Currently testing on M2 Max with Metal enabled, built in Release mode from latest commit on master branch from may 14th, trying to use the LoRA example in the readme:
This just generates an all black image. Without the LoRA it works as expected. EDIT: I did some additional testing and on Windows using a CPU only release build (no CUDA) I get the same all black output. On Windows using a CUDA release build, it crashes when it tries to load the LoRA weights. So it's not just a Mac thing at least. I'm happy to more testing, including on Linux. Please just let me know. |
On this build most of the lora's i have will cause a black image as an output.
I'm not entirely sure why this would be the case, but the next build after that one spams the console with this for a large amount of tensors
[ERROR] model.cpp:893 - skip tensor 'lora_unet_output_blocks_5_1_transformer_blocks_1_ff_net_2.alpha' with n_dims 0
The text was updated successfully, but these errors were encountered: