huggingface / huggingface/diffusers

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

Aperta
#10,403 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug needs-code-example stale
Lingua principale
Python
Stelle
34.5k
Fork
7.3k
Merge medio
3g 3h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start at the FluxControlNetPipeline entry point and trace how enable_sequential_cpu_offload and pipeline device moves are detected when the transformer is a PeftModel. Reproduce the reported snippets with diffusers 0.33.0.dev0 and peft 0.14.0, then verify that loading through PeftModel does not incorrectly block moving the pipeline to CUDA.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python, pytorch
Ambito
machine-learning
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.