Downloads · 30 days
93
2% of all-time downloads
NimVideo/cogvideox1.5-5b-prompt-camera-motion
cogvideox1.5-5b-prompt-camera-motion is a video-to-video model from NimVideo. Use it for the video-to-video task on the model card, and read the license before you ship it in a product. It is set up for diffusers. The card lists the license as apache-2.0.
Downloads · 30 days
93
2% of all-time downloads
All-time downloads
3.8K
Public
Repo size
264 MB
Likes
46
Public
Click a slice to open those files.
.safetensors264 MB · 100%
From the Hugging Face model README
This LoRa (Low-Rank Adapter) model extends CogVideoX to control camera movement in 6 directions: left, right, up, down, zoom_in, and zoom_out. The LoRa can generate smooth camera motions for enhanced video creation.
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/63fde49f6315a264aba6a7ed/sFer38aCSYiWtqQIrVJm9.mp4"></video>
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/63fde49f6315a264aba6a7ed/pwyqKU0xLHZ6TuUda7hez.mp4"></video>
The LoRa was trained to control camera movement in 6 directions: left, right, up, down, zoom_in, zoom_out.
Start prompt with text like this:
'Сamera moves to the {}...',
'Сamera is moving to the {}...',
'{} camera movement...',
'{} camera turn...',
<a href="https://huggingface.co/NimVideo/cogvideox1.5-5b-prompt-camera-motion/blob/main/cogvideox_1_5_5b_I2V_prompt_motion_lora_example.json">JSON File Example</a>
import torch
from diffusers import CogVideoXImageToVideoPipeline
from diffusers.utils import export_to_video, load_image
pipe = CogVideoXImageToVideoPipeline.from_pretrained(
"THUDM/CogVideoX1.5-5B-I2V", torch_dtype=torch.bfloat16
)
pipe.load_lora_weights("NimVideo/cogvideox1.5-5b-prompt-camera-motion", adapter_name="cogvideox-lora")
pipe.set_adapters(["cogvideox-lora"], [1.0])
pipe.enable_sequential_cpu_offload()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()
height = 768
width = 1360
image = load_image("resources/car.jpg").resize((width, height))
prompt = "Camera is moving to the left. A red sports car driving on a winding road."
video_generate = pipe(
image=image,
prompt=prompt,
height=height,
width=width,
num_inference_steps=50,
num_frames=81,
guidance_scale=6.0,
generator=torch.Generator().manual_seed(42),
).frames[0]
export_to_video(video_generate, output_path, fps=8)
Original code and models CogVideoX.