diffusers
Fix possible re-conversion issues after extracting from safetensors
#6097
Merged

Fix possible re-conversion issues after extracting from safetensors #6097

patrickvonplaten merged 2 commits into huggingface:main from d8ahazard:main
d8ahazard
d8ahazard1 year ago

Properly rename specific vae keys.

What does this PR do?

When extracting a sd 1.5 .safetensors using the from_single_file and then save_pretrained methods (as found in the convert_original_stable_diffusion_to_diffusers.py script), a handful of the vae keys are not properly renamed.

This fixes that issue.

I determined this by first extracting and then re-compiling the v1-5-pruned-emaonly.safetensors file using the stock script, then re-compiling it the same way.

I then did a diff of the keys from the two checkpoints, and noted the differences this change fixes.

After applying this patch, the keys between the two models were almost exactly the same, with the exception of a handful of other keys that don't appear to be related to the actual model weights.

Fixes # (issue)

Before submitting

  • [ x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • [x ] Did you read the contributor guideline?
  • [x ] Did you read our philosophy doc (important for complex PRs)?
  • [ x] Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
  • [x ] Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • [x ] Did you write any new necessary tests?

Who can review?

@patrickvonplaten
@sayakpaul

d8ahazard Fix possible re-conversion issues after extracting from diffusers
df28313a
d8ahazard Whoops
3c76719a
HuggingFaceDocBuilderDev
HuggingFaceDocBuilderDev1 year ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

d8ahazard d8ahazard changed the title Fix possible re-conversion issues after extracting from diffusers Fix possible re-conversion issues after extracting from safetensors 1 year ago
sayakpaul sayakpaul requested a review from DN6 DN6 1 year ago
patrickvonplaten
patrickvonplaten1 year ago

Ok!

patrickvonplaten patrickvonplaten merged 6976cab7 into main 1 year ago

Login to write a write a comment.

Login via GitHub

Reviewers
Assignees
No one assigned
Labels
Milestone