huggingface / huggingface/diffusers
Remove redundant comparison inside the diffusion loop of stable video diffusion pipeline
- Lingua principale
- Python
- Stelle
- 34.5k
- Fork
- 7.3k
- Merge medio
- 3g 3h
- PR unite (30g)
- 91
Descrizione
**Is your feature request related to a problem? Please describe.**
I found that the inside the `__call__` of stable video diffusion keeps doing async memcpy between host to device as attached.
**Describe the solution you'd like.**
The reason for that is actually coming from every time we get `self.do_classifier_free_guidance`, we compared tensor between `int` -> get boolean on device -> memcpy that boolean from gpu to cpu.
It'll be good to just assign a variable for it before the loop as the value won't change through the loop.
**Additional context.**
I'm glad to contribute this by opening a PR
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start at the stable video diffusion pipeline's __call__ method and inspect the diffusion loop where self.do_classifier_free_guidance is repeatedly evaluated. Cache the unchanged value before the loop, then verify the loop no longer performs that repeated comparison or associated host-device transfer.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python, pytorch
- Ambito
- machine-learning, performance
- Tipo di issue
- Refactoring
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100