huggingface / huggingface/diffusers

Remove redundant comparison inside the diffusion loop of stable video diffusion pipeline

Open
#9,425 8 comments 0 reactions 0 assignees View on GitHub
stale
Dominant language
Python
Stars
34.5k
Forks
7.3k
Avg merge
3d 3h
Merged PRs (30d)
91

Description

**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.
Screenshot 2024-09-12 at 6 45 24 PM

**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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.