Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b5863c2
Enable the i2vgenpipeline
yuanwu2017 Nov 15, 2024
0a16d64
Debug memory issue
yuanwu2017 Nov 21, 2024
e90726a
Cpu offload
yuanwu2017 Nov 22, 2024
3a40645
Merge branch 'main' into i2v-debug
yuanwu2017 Dec 26, 2024
2fccd3f
Use the FusedSdpa
yuanwu2017 Jan 6, 2025
1a49704
Use graph mode
yuanwu2017 Jan 15, 2025
dc544b4
Optimize the i2v pipeline
yuanwu2017 Jan 18, 2025
0b8ccd7
Fix the reshape error
yuanwu2017 Jan 18, 2025
e3026bc
Fix the error
yuanwu2017 Jan 18, 2025
ef93e3c
Fix the error and clean the code
yuanwu2017 Jan 18, 2025
5dbb14b
Add i2v example and clean code
yuanwu2017 Jan 19, 2025
24930eb
Add the export_to_gif
yuanwu2017 Jan 19, 2025
7e3becf
Fix the video size issue
yuanwu2017 Jan 19, 2025
b4612e0
Add comments and clean the code
yuanwu2017 Jan 19, 2025
cb192f7
Remove debug files
yuanwu2017 Jan 19, 2025
ba7c9f4
Remove useless modifications.
yuanwu2017 Jan 19, 2025
10df9ca
Fix errors of make style
yuanwu2017 Jan 19, 2025
94df7fe
Change the default value
yuanwu2017 Jan 20, 2025
b2bddba
Add the sdp_on_bf16
yuanwu2017 Jan 20, 2025
8cdcf70
Add default value for negative_prompts
yuanwu2017 Jan 20, 2025
b379365
Add ReadME
yuanwu2017 Jan 20, 2025
e3ef373
Update examples/stable-diffusion/image_to_video_generation.py
yuanwu2017 Jan 30, 2025
ef14e26
Remove reloading image
yuanwu2017 Jan 30, 2025
d2c4fa4
Merge branch 'huggingface:main' into i2v-debug
yuanwu2017 Jan 31, 2025
07db61b
Add CI test
yuanwu2017 Jan 31, 2025
a3c8129
Fix errors of make style
yuanwu2017 Jan 31, 2025
827f16a
Fix ReadME typo
yuanwu2017 Jan 31, 2025
c54bf41
Change to is_i2v_model
yuanwu2017 Feb 6, 2025
0afc536
Remove the examples commands in README.
yuanwu2017 Feb 6, 2025
ed98a1b
Fix typo
yuanwu2017 Feb 6, 2025
c8b075d
Enable the autocast according to gaudi_config
yuanwu2017 Feb 6, 2025
2dbfc20
Update tests/test_diffusers.py
yuanwu2017 Feb 7, 2025
c5e08ec
Merge branch 'huggingface:main' into i2v-debug
yuanwu2017 Feb 7, 2025
a22e73b
Add the i2vgen-xl into ReadME and docs
yuanwu2017 Feb 7, 2025
51b48cd
Merge branch 'huggingface:main' into i2v-debug
yuanwu2017 Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions examples/stable-diffusion/i2v.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import torch
from diffusers.utils import export_to_gif, load_image

from optimum.habana.diffusers import GaudiI2VGenXLPipeline

def main() :
torch._C._set_math_sdp_allow_fp16_bf16_reduction(True)
pipeline = GaudiI2VGenXLPipeline.from_pretrained(
"ali-vilab/i2vgen-xl",
torch_dtype=torch.bfloat16,
use_hpu_graphs=False,
use_habana=True,
gaudi_config="Habana/stable-diffusion",
)
#torch_dtype=torch.float,
# import pdb;pdb.set_trace()
# breakpoint()
pipeline.enable_model_cpu_offload(device="hpu")

image_url = "https://huggingface.co/datasets/diffusers/docs-images/resolve/main/i2vgen_xl_images/img_0009.png"
image = load_image(image_url).convert("RGB")

prompt = "Papers were floating in the air on a table in the library"
negative_prompt = "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
generator = torch.manual_seed(8888)
# import pdb;pdb.set_trace()
# breakpoint()
frames = pipeline(
prompt=prompt,
image=image,
num_inference_steps=50,
negative_prompt=negative_prompt,
guidance_scale=9.0,
generator=generator,
).frames[0]
export_to_gif(frames, "i2v.gif")

if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions optimum/habana/diffusers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
GaudiStableVideoDiffusionControlNetPipeline,
)
from .pipelines.ddpm.pipeline_ddpm import GaudiDDPMPipeline
from .pipelines.i2vgen_xl.pipeline_i2vgen_xl import GaudiI2VGenXLPipeline
from .pipelines.flux.pipeline_flux import GaudiFluxPipeline
from .pipelines.flux.pipeline_flux_img2img import GaudiFluxImg2ImgPipeline
from .pipelines.pipeline_utils import GaudiDiffusionPipeline
Expand Down
2 changes: 1 addition & 1 deletion optimum/habana/diffusers/models/unet_2d_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def gaudi_unet_2d_condition_model_forward(
timesteps = timesteps.expand(sample.shape[0])

t_emb = self.time_proj(timesteps)

print(f"mark_step")
import habana_frameworks.torch.core as htcore

htcore.mark_step()
Expand Down
Loading