Skip to content
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

Fix mid block checker to fix custom model loading #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Dango233
Copy link

@Dango233 Dango233 commented Feb 3, 2023

The from_pretrained_2d runs into ValueError: unknown mid_block_type: UNetMidBlock2DCrossAttn when "mid_block_type": "UNetMidBlock2DCrossAttn" is specified in the config file of pertained unet.

This happens with some custom models (model converters could be a cause) but won't happen with the official models.

This PR fixes the problem by allowing UNetMidBlock2DCrossAttn in the type check.

@Dango233 Dango233 changed the title Fix mid block checker to avoid problem with custom models Fix mid block checker to fix custom model loading Feb 3, 2023
@zhangjiewu
Copy link
Collaborator

just wondering what kind of custom models you are using?

@Dango233
Copy link
Author

Dango233 commented Feb 4, 2023

I used a model trained under the CompVis/Stable-diffusion format. I got it converted to diffusers format using this conversion script:

https://github.com/huggingface/diffusers/blob/main/scripts/convert_original_stable_diffusion_to_diffusers.py

@Dango233
Copy link
Author

Dango233 commented Feb 5, 2023

Seems that the config saved using diffusers' save_pretrained method will have this problem

@kangqiyue
Copy link

Thanks! cool !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants