Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix video diffusion black output if --bf16 is set. #1685

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sywangyi
Copy link
Collaborator

@sywangyi sywangyi commented Jan 9, 2025

add hpu graph support

follow the readme guide
PT_HPU_MAX_COMPOUND_OP_SIZE=1 python image_to_video_generation.
py --model_name_or_path "stabilityai/stable-video-diffusion-img2vid-xt" --image_path "https://huggingface.co/datasets/huggingface/document
ation-images/resolve/main/diffusers/svd/rocket.png" --num_videos_per_prompt 1 --video_save_dir /tmp/stable_video_diffusion_xt --save_frames_as_images --use_habana --use_hpu_graphs --gaudi_config Habana/stable-diffusion --sdp_on_bf16 --bf16

the output video is black in 1.19

add hpu graph support

Signed-off-by: Wang, Yi A <[email protected]>
@sywangyi sywangyi requested a review from regisss as a code owner January 9, 2025 02:54
@sywangyi
Copy link
Collaborator Author

sywangyi commented Jan 9, 2025

find it's caused by sdpa. so use hpu AttnProcessor2_0 to replace the original one

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sywangyi
Copy link
Collaborator Author

sywangyi commented Jan 9, 2025

@libinta @dsocek pls help review

Copy link

The code quality check failed, please run make style.

Copy link
Contributor

@dsocek dsocek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dsocek
Copy link
Contributor

dsocek commented Jan 10, 2025

(Need to run make style to comply with code quality)

@libinta libinta added the run-test Run CI for PRs from external contributors label Jan 22, 2025
@@ -372,7 +383,7 @@ def __call__(
# 4. Encode input image using VAE
image = self.video_processor.preprocess(image, height=height, width=width)
# torch.randn is broken on HPU so running it on CPU
rand_device = "cpu" if device.type == "hpu" else device
rand_device = torch.device("cpu") if device.type == "hpu" else device
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sywangyi is it still requiring rand to be on cpu to fix the black output issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, black issue is fixed by using fused sdpa, and sdp_on_bf16.
this "cpu“ is fix the ci failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-test Run CI for PRs from external contributors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants