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

pipeline fail to move to "cuda" if one of the component is PeftModel #10403

Open
Erisura opened this issue Dec 28, 2024 · 1 comment
Open

pipeline fail to move to "cuda" if one of the component is PeftModel #10403

Erisura opened this issue Dec 28, 2024 · 1 comment
Labels
bug Something isn't working needs-code-example Waiting for relevant code example to be provided

Comments

@Erisura
Copy link

Erisura commented Dec 28, 2024

When I was doing infer, I loaded the pre-trained weights using the following method:

self.transformer = PeftModel.from_pretrained(
            self.base_transformer,
            lora_model_path
        )

and loaded the pipeline in the following way:

pipe = FluxControlNetPipeline(transformer=transformer, ......)

However, I encountered an error when running it:
ValueError: It seems like you have activated sequential model offloading by calling enable_sequential_cpu_offload, but are now attempting to move the pipeline to GPU. This is not compatible with offloading. Please, move your pipeline .to('cpu') or consider removing the move altogether if you use sequential offloading.

Strangely, I have never manually set sequential model offloading. And I found that if I didn't call

self.transformer =  PeftModel.from_pretrained(
            self.base_transformer,
            lora_model_path
        )

Instead, directly set self.transformer = self.base_transformer, and the subsequent code remains unchanged, the above error will not occur.
If there's someone who has encountered the same issue?

System Info

diffusers==0.33.0.dev0
peft==0.14.0

@yiyixuxu @sayakpaul @DN6

@Erisura Erisura added the bug Something isn't working label Dec 28, 2024
@sayakpaul
Copy link
Member

Can you provide a minimal reproducible snippet? The code is not reproducible.

@sayakpaul sayakpaul added the needs-code-example Waiting for relevant code example to be provided label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-code-example Waiting for relevant code example to be provided
Projects
None yet
Development

No branches or pull requests

2 participants