Views
No views yet
pip install git+https://github.com/huggingface/diffusers.git peft transformers torch sentencepiece opencv-python1from diffusers import MochiPipeline
2from diffusers.utils import export_to_video
3import torch
4
5pipe = MochiPipeline.from_pretrained("genmo/mochi-1-preview", torch_dtype = torch.float16)
6pipe.load_lora_weights("svjack/mochi_Lily_Bikini_early_lora")
7pipe.enable_model_cpu_offload()
8pipe.enable_sequential_cpu_offload()
9pipe.vae.enable_slicing()
10pipe.vae.enable_tiling()
11
12i = 50
13generator = torch.Generator("cpu").manual_seed(i)
14prompt = "Lily: The video features a woman with blonde hair wearing a black one-piece swimsuit. She is standing on a sandy beach with the ocean in the background, where waves are visible crashing onto the shore. The sky is clear with a few scattered clouds, suggesting a sunny day. The woman appears to be holding a piece of driftwood or a similar object in her right hand. Her stance and expression suggest she is posing for the camera."
15pipeline_args = {
16 "prompt": prompt,
17 "num_inference_steps": 64,
18 "height": 480,
19 "width": 848,
20 "max_sequence_length": 1024,
21 "output_type": "np",
22 "num_frames": 19,
23 "generator": generator
24 }
25
26video = pipe(**pipeline_args).frames[0]
27export_to_video(video, "Lily_Lora.mp4")
28from IPython import display
29display.clear_output(wait = True)
30display.Video("Lily_Lora.mp4")