huggingface / huggingface/diffusers

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

オープン
#10,403 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug needs-code-example stale
主要言語
Python
スター
34.5k
フォーク
7.3k
平均マージ
3日 3時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, pytorch
領域
machine-learning
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。