huggingface / huggingface/diffusers

`from_pipe` converts pipelines to float32 by default

Offen
#12,754 13 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### Describe the bug

Pipelines passed to `from_pipe()` are converted to float32 unless `torch_dtype` is specified, leading to higher memory usage and slower inference.

### Reproduction
```python
import torch
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline

pipe = StableDiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch.float16).to("cuda")
print(f"Before: {pipe.dtype} - {torch.cuda.memory_allocated() // 1048576} MB")

i2i = StableDiffusionImg2ImgPipeline.from_pipe(pipe)
print(f"After: {pipe.dtype} - {torch.cuda.memory_allocated() // 1048576} MB")
```
### Logs
```
Loading pipeline components...: 0%| | 0/7 [00:00

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start at the `from_pipe()` entry point and reproduce the conversion with the StableDiffusionPipeline and StableDiffusionImg2ImgPipeline example from the issue. Compare the pipeline dtype and CUDA memory before and after conversion. Done means a pipeline passed through `from_pipe()` retains the source dtype by default without requiring `torch_dtype`.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, pytorch
Bereich
machine-learning, performance
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.