Facing an Error.

#1
by xi0v - opened

Hello, I duplicated your space earlier today to convert one of my checkpoints to diffusers but when I try to I keep facing errors;

(OK):download completed.
Download completed: 
Some weights of the model checkpoint were not used when initializing CLIPTextModel: 
 ['text_model.embeddings.position_ids']
File to download alreday exists: https://huggingface.co/nubby/blessed-sdxl-vae-fp16-fix/blob/main/sdxl_vae-fp16fix-blessed.safetensors
Download completed: https://huggingface.co/nubby/blessed-sdxl-vae-fp16-fix/blob/main/sdxl_vae-fp16fix-blessed.safetensors
Use local file: 
Download failed: 
LoRA not found: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 276, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1897, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1483, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 816, in wrapper
    response = f(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 816, in wrapper
    response = f(*args, **kwargs)
  File "/home/user/app/convert_url_to_diffusers_sdxl_gr.py", line 315, in convert_url_to_diffusers_repo
    new_path = convert_url_to_diffusers_sdxl(dl_url, civitai_key, is_upload_sf, half, vae, scheduler, lora_dict)
  File "/home/user/app/convert_url_to_diffusers_sdxl_gr.py", line 251, in convert_url_to_diffusers_sdxl
    fuse_loras(pipe, lora_dict, temp_dir, civitai_key)
  File "/home/user/app/convert_url_to_diffusers_sdxl_gr.py", line 211, in fuse_loras
    pipe.set_adapters(a_list, adapter_weights=w_list)
  File "/usr/local/lib/python3.10/site-packages/diffusers/loaders/lora_base.py", line 573, in set_adapters
    model.set_adapters(adapter_names, _component_adapter_weights[component])
KeyError: 'unet'

I did not choose any LoRAs.

I would appreciate it if you please fix it as soon as possible ๐Ÿ™๐Ÿป
(Not sure if it matters, but I used the default preset and half precision)

Thanks for using it. And thanks for the bug report.
The bug was caused by a GUI I added later that was putting strange values in the LoRA field.
I think I fixed it now to go through the strange values, but I'm still checking it works...๐Ÿ˜…

Your welcome! This space is really unique because I can fuse LoRA into the model which is something I never saw on a space before. (Random question because I'm just getting into Stable Diffusion but does it fuse the LoRA into the single .safetensors file?)
Also Thanks for the quick reply!
I'll keep an eye on this issue and give it a try again once you fully fix it.
Thanks!

The HF movement was kind of slow, but I just confirmed that it is fixed now. (Maybe...)

As for LoRA, it really merges the files, it's a feature in Diffusers, similar to merging models in other environments. It cannot be undone.

So the best way to use it would be to use LoRA to change the style of the image itself, or to use it for speedups like LCM or Hyper-SD.
If you mix a character LoRA, you end up with a model dedicated to that character.๐Ÿ˜ฑ

I still can't get it done, I get this error;

huggingface_hub.errors.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: ./Model-v1.safetensors

And also an error that tells me that a LoRA name cannot contain a " . " And errors out.
If you have enough time, I'd appreciate it if you go through the code for this space. ๐Ÿ™๐Ÿป

Thank you for educating me in this, I really appreciate it!
Also speaking of model merging, have you ever came across a colab notebook that allows me to merge SDXL/pony models? I really want to get into it but I can't find colab notebooks or spaces for it.

https://huggingface.co/xi0v/ProjectMiko-V1-Final/blob/main/Miko-v1.safetensors
I get the same symptoms. I've been called in for a bit and I'll fix it in a few hours.
Perhaps there is an error in the decomposition of the path here.

Depending on the path, it can be successful.
https://huggingface.co/bluepen5805/anima_pencil-XL/blob/main/anima_pencil-XL-v5.0.0.safetensors

Take your time!
I will keep doing more testing and see what works.
I Appreciate your help ๐Ÿ™๐Ÿป

After re-reading the code, I discovered an easy mistake that made me question my sanity. I have fixed it and it should now work. Thanks and sorry.๐Ÿ˜“

I'm not familiar with Colab.
When it comes to merging models, as long as you can launch A1111 WebUI in Colab, you should be able to do it with Checkpoint Merger.
I heard that in an environment where VRAM is more than RAM like Colab, it is faster to change the standard settings a little as follows (environment dependent, but you get the point).

%cd /content/stable-diffusion-webui
!sed -i "s/'cpu'/devices.get_optimal_device()/g" modules/extras.py

I heard that SuperMerger can do more if you have enough machine power.
https://github.com/hako-mikan/sd-webui-supermerger

Owner
โ€ข
edited Jul 30

I just found out that we were kicked out of Colab by name, WebUI...
I heard we could use it for many things in the past.

How to Script Merge Flow Quickly for Colab
https://civitai.com/articles/1619/how-to-script-merge-flow-quickly-for-colab
https://github.com/Faildes/Chattiori-Model-Merger/

Some Notebooks may still be alive, so I'll post the author's page.
https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Online-Services

I heard that for a flat monthly fee and leisurely use, paperspace is cheaper than Colab right now.
If you are okay with pay-as-you-go, Colab Pro is said to be faster.
https://github.com/sheldonchiu/Ultimate-Paperspace-Template
https://github.com/Engineer-of-Stuff/stable-diffusion-paperspace
https://github.com/Engineer-of-Stuff/stable-diffusion-paperspace/blob/master/docs/Paperspace%20Guide%20for%20Idiots.md

Hello! Thanks for fixing it, I'll test it and close this discussion!

Yeah colab has been banning notebooks and sometimes even users for launching SD webuis since the colab session needs to be "interactive"

I might check out paperspace and colab pro. thanks!

Thanks for making me aware of a bad bug I hadn't noticed.
You can find a lot of information on Civitai and other Articles and on the Japanese wiki. Merging is very active.
See you. ๐Ÿ˜„

Seems like it works!
You're welcome! I'll be using this space alot, I'll report any bugs I find to you.
I'll definitely do my research on merging. For now I'm using sd-mecha
To do basic model merging on colab.
Again, thanks!

xi0v changed discussion status to closed

Sign up or log in to comment