Better than previous versions, but still doesn't work for all ckpt files

#1
by johnslegers - opened

The latest version of this conversion script is definitely better than previous versions and seems to work on most ckpt files it didn't work before.

It still breaks & sends empty PR requests for some files, though.

So far, I've found two models this conversion script still doesn't work with :

Hey @johnslegers ,

Thanks a lot for sending those examples that's super nice! I'll try to convert them :-)

@patrickvonplaten :

My pleasure... seriously...

It is in my own best interest that this space supports as many different checkpoints as possible...

I created Epic Diffusion by merging a whole bunch of other models, many of which were converted to diffusers format for testing & harmonization purposes using the old version of this space.

Your changes to this space already allowed me to mark several models as possible merge candidates for V1.1 that weren't an option before.

That's awesome! I took a look into the problem and it's because the original .ckpt was saved in the safetensors format: https://github.com/huggingface/safetensors
More specifically, this checkpoint: https://huggingface.co/patrickvonplaten/the_allys_mix/blob/main/model.ckpt was saved in safetensors format.

I've updated the space to now also support this format and made sure it works correctly on: https://civitai.com/models/1202/the-allys-mix , see: https://huggingface.co/patrickvonplaten/the_allys_mix/discussions/3

Note that in order to convert from the safetensors format you need to select it:

Screenshot_20230110_154255.png

By default it is set to "False" because most checkpoints are not saved in safetensor format.
I'd recommend the following as a general procedure.

  1. Try out converting the checkpoint with "ema" and "no" for "safetenors"
  2. => if this gives an empty PR, try "non-ema" and "no" for "safetensors"
  3. => if this gives an empty PR, try "ema" and "yes" for "safetensors"
  4. => if this gives an empty PR, try "non-ema" and "yes" for "safetensors"
  5. => if this gives an empty PR 😢 and open an issue on https://github.com/huggingface/diffusers or leave a message here.

If you'd like maybe you could try it out on: https://civitai.com/models/1258/aloeveras-simpmaker-3k-series

@patrickvonplaten :

Thanks for all the world you've put into this.

Unfortuinately, I get this error when I try to execute it on the ckpt files I saved for both models and I select the value "yes" for "safetensors" :

Error while deserializing header: HeaderTooLarge

Any idea what might be causing this?

johnslegers changed discussion status to closed
johnslegers changed discussion status to open

OK, so I think you made a mistake here...

On https://civitai.com/models/1202/the-allys-mix, there's two versions of the model :

  • A 2.63 GB ckpt / "pickletensor" file
  • A 4.27 GB safetensor file

It appears you downloaded the 4.27 GB safetensor file.

I can confirm that, with your latest changes, the conversion script now supports safetensor files, which is friggin' awesome. However, it still expects the *.ckpt extension. It would be nice to also support the *.safetensors extension (I created https://huggingface.co/spaces/diffusers/sd-to-diffusers/discussions/2 for that).

The conversion script still breaks for the 2.63 GB ckpt file, though.

Hi there, thanks for all the work!
I have the same problem, even with all the possible combinations, the PR is empty

Ive cloned the reppo to check the logs.
Even though it returns a success and create the RP (empty) it throws an error:

Traceback (most recent call last):
File "./diffs/scripts/convert_original_stable_diffusion_to_diffusers.py", line 982, in
text_model = convert_open_clip_checkpoint(checkpoint)
File "./diffs/scripts/convert_original_stable_diffusion_to_diffusers.py", line 751, in convert_open_clip_checkpoint
d_model = int(checkpoint["cond_stage_model.model.text_projection"].shape[0])
KeyError: 'cond_stage_model.model.text_projection'

This is the same error I get when trying to run the diffusers script from github locally

Same problem for me: I've got a 2.13 GB file that came from fine-tuning using Dreambooth (here: https://github.com/TheLastBen/fast-stable-diffusion). For "safetensors no" it gives an empty PR, for "safetensors yes" it fails immediately with "Error while deserializing header: HeaderTooLarge".

EDIT: I'm just a moron. The link that the tool produces doesn't work, but the commits are generated properly. Just go back to the repository and it's there.

I get this error from a civitai model:

global_step key not found in model
Failed to convert ... with error 'state_dict'

@brurpo & @jchook :

Y'all may want to add links to the models you're unable to convert.

To fix any errors, @patrickvonplaten (or his colleagues) will need to be able to reproduce the errors first. That's gonna be quite difficult without actually having access to those models...

Hi, is model v1 for SD 1.5 and v2 for SD 2.0?

I am getting the KeyError: 'cond_stage_model.model.text_projection' error mentioned above on every SD 2.1 model from CivitAI. One example:

https://civitai.com/models/8124/a-to-zovya-rpg-artists-tools-15-and-21 SD 2.1 768 V1

Sign up or log in to comment