Installtion
pip install git+https://github.com/huggingface/diffusers.git peft transformers torch sentencepiece opencv-python
Example
from diffusers import MochiPipeline
from diffusers.utils import export_to_video
import torch
pipe = MochiPipeline.from_pretrained("genmo/mochi-1-preview", torch_dtype = torch.float16)
pipe.load_lora_weights("svjack/mochi_game_landscape_early_lora")
pipe.enable_model_cpu_offload()
pipe.enable_sequential_cpu_offload()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()
i = 50
generator = torch.Generator("cpu").manual_seed(i)
pipeline_args = {
"prompt": "The video presents a tranquil scene of a small, isolated island with a rocky outcrop. The island is covered in lush greenery and dotted with vibrant pink cherry blossom trees in full bloom. A traditional-style building with a pagoda-like roof stands prominently on the highest point of the island, suggesting a cultural or historical significance. The sky above is a gradient of soft pastel colors, transitioning from light blue to pink, indicating either dawn or dusk. The water surrounding the island is calm, reflecting the colors of the sky and the island's features. There are no visible people or moving objects, giving the scene a serene and untouched quality.",
"guidance_scale": 6.0,
"num_inference_steps": 64,
"height": 480,
"width": 848,
"max_sequence_length": 1024,
"output_type": "np",
"num_frames": 19,
"generator": generator
}
video = pipe(**pipeline_args).frames[0]
export_to_video(video, "Island_scene.mp4")
from IPython import display
display.clear_output(wait = True)
display.Video("Island_scene.mp4")