-
Notifications
You must be signed in to change notification settings - Fork 234
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
add cogvideox support for gaudi. #1600
base: main
Are you sure you want to change the base?
Conversation
test command:python cogvideo_generate.py --model_name_or_path /mnt/disk2/libo/hf_models/CogVideoX-2b/ --output_name |
panda_gaudi.mp4 |
could you please help to review my change @shepark |
I sent email to you, please response it. thanks. |
Hi @regisss , could you please help to review this PR? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments for requested changes. Also, please run make style
to fix code formatting
@@ -0,0 +1,86 @@ | |||
import argparse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this file and use text_to_video_generation.py
script for this sample (need to switch pipeline based on model, similarly as one in text_to_image_generation.py
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file has been removed.
optimum/habana/diffusers/__init__.py
Outdated
@@ -1,3 +1,4 @@ | |||
from .pipelines.cogvideox.cogvideoX_gaudi import adapt_cogvideo_to_gaudi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove from here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
@@ -0,0 +1,468 @@ | |||
from typing import Any, Dict, Optional, Tuple, Union |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file does not belong here. Either add these definitions to your cogvideox pipeline py file, or maybe put some of the attention functions under optimum/habana/diffusers/models/*
and rest inside cogvideox pipeline py file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file has been removed.
from diffusers.models.autoencoders.autoencoder_kl_cogvideox import AutoencoderKLCogVideoX | ||
|
||
|
||
class AutoencoderKLCogVideoXGaudi(AutoencoderKLCogVideoX): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapted from? Please put reference here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file and function removed.
from diffusers.models.autoencoders.vae import DecoderOutput | ||
|
||
|
||
class CogVideoXCausalConv3dGaudi(nn.Module): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapted from? Please put reference here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function removed.
frames: torch.Tensor | ||
|
||
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.retrieve_timesteps | ||
def retrieve_timesteps( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we import this directly from diffusers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for cogvideoX model does not copy.
logger = logging.get_logger(__name__) # pylint: disable=invalid-name | ||
|
||
|
||
class time_box_t(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use same timing mechanism as in other pipelines (need to deal with warmup etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
htcore.mark_step() | ||
time_box.show_time('transformer_hpu') | ||
|
||
#HabanaProfile.stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
tests/test_diffusers.py
Outdated
).frames[0] | ||
|
||
assert video is not None | ||
assert 49 == len(video) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use self.assertEqual
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
tests/test_diffusers.py
Outdated
generator=torch.Generator(device="cpu").manual_seed(42), | ||
).frames[0] | ||
|
||
assert video is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use self.assertIsNotNone
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@regisss @nc-BobLee can we merge this change? |
@nc-BobLee can you, please, address some of the requested changes? |
I have addressed the requested changes. please help to review. @regisss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the requested changes. Please rebase and resolve conflicts and run make style
to fix code formatting.
Co-authored-by: regisss <[email protected]>
@regisss Please help to review the changes. All the codes are updated now. Thanks! |
What does this PR do?
Fixes # (issue)
Before submitting