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

Error using from_single_file / not working #21

Open
Subcode opened this issue Dec 9, 2023 · 2 comments
Open

Error using from_single_file / not working #21

Subcode opened this issue Dec 9, 2023 · 2 comments

Comments

@Subcode
Copy link

Subcode commented Dec 9, 2023

Traceback (most recent call last):
File "/home/user/Repositories/run.py", line 6, in
pipe = DemoFusionSDXLPipeline.from_single_file(model_ckpt)
File "/home/user/Repositories/env/lib/python3.10/site-packages/diffusers/loaders.py", line 2268, in from_single_file
raise ValueError(f"Unhandled pipeline class: {pipeline_name}")
ValueError: Unhandled pipeline class: DemoFusionSDXLPipeline

Even after fixing this it does not work giving other errors from init.
I see references in the pipeline file so i assumed this should work?

@Subcode Subcode changed the title [BUG] Error using from_single_file Error using from_single_file / not working Dec 9, 2023
@Laidawang
Copy link

Laidawang commented Dec 11, 2023

pipe_base = StableDiffusionXLPipeline.from_single_file(PATH,torch_dtype=torch.float16) pipe = DemoFusionSDXLPipeline( vae = pipe_base.vae, text_encoder = pipe_base.text_encoder, text_encoder_2 = pipe_base.text_encoder_2, tokenizer = pipe_base.tokenizer, tokenizer_2 = pipe_base.tokenizer_2, unet = pipe_base.unet, scheduler = pipe_base.scheduler, force_zeros_for_empty_prompt = pipe_base.force_zeros_for_empty_prompt, )
try this,works for me.

@deroberon
Copy link

deroberon commented Dec 16, 2023

I can help on the root cause of this one. This is because the diffusers python library, in the "single_file.py" (where implements "from_single_file" function) expects that the class name contains the word "StableDiffusion", as you can see here:

https://github.com/huggingface/diffusers/blob/2d94c7838e273c40920ffd6d24d724357add7f2d/src/diffusers/loaders/single_file.py#L207C15-L207C30

and the class implemented here in pipeline_demodifusion_sdxl.py is called "DemoFusionSDXLPipeline" and for not contain the "StableDiffusion" word in the name, the load function fails.

Just changing the name of the class for something like: "DemoFusionStableDiffusionSDXLPipeline" will solve the problem and you can use from_single_file almost without any additional args.

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

No branches or pull requests

3 participants