Views
No views yet
1import torch
2from diffusers import CogVideoXImageToVideoPipeline
3from diffusers.utils import load_image, export_to_video
4
5pipe = CogVideoXImageToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b-I2V", torch_dtype=torch.bfloat16).to("cuda")
6pipe.load_lora_weights("BelGio13/cogvideoX-I2V-locobot", weight_name="pytorch_lora_weights.safetensors", adapter_name="cogvideox-i2v-lora")
7
8# The LoRA adapter weights are determined by what was used for training.
9# In this case, we assume `--lora_alpha` is 32 and `--rank` is 64.
10# It can be made lower or higher from what was used in training to decrease or amplify the effect
11# of the LoRA upto a tolerance, beyond which one might notice no effect at all or overflows.
12pipe.set_adapters("cogvideox-i2v-lora", [32 / 64])
13
14image = load_image("/path/to/image")
15video = pipe(image=image, "", guidance_scale=6, use_dynamic_cfg=True).frames[0]
16export_to_video(video, "output.mp4", fps=8)# TODO: add an example code snippet for running this diffusion pipeline