Instructions to use Video-Reason/VBVR-Pro-LTX2.3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Video-Reason/VBVR-Pro-LTX2.3 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image, export_to_video # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Video-Reason/VBVR-Pro-LTX2.3", dtype=torch.bfloat16, device_map="cuda") pipe.to("cuda") prompt = "A man with short gray hair plays a red electric guitar." image = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png" ) output = pipe(image=image, prompt=prompt).frames[0] export_to_video(output, "output.mp4") - Notebooks
- Google Colab
- Kaggle
| """VBVR-Pro-LTX2.3 image-to-audio-video inference example. | |
| Usage: | |
| python example.py --model_path Video-Reason/VBVR-Pro-LTX2.3 \ | |
| --image input.png --prompt "Your video instruction" | |
| """ | |
| import argparse | |
| import torch | |
| from diffusers import LTX2ImageToVideoPipeline | |
| from diffusers.utils import encode_video, load_image | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--model_path", type=str, default="Video-Reason/VBVR-Pro-LTX2.3") | |
| parser.add_argument("--image", type=str, required=True, help="Path or URL to input image") | |
| parser.add_argument("--prompt", type=str, required=True, help="Video instruction") | |
| parser.add_argument( | |
| "--negative_prompt", | |
| type=str, | |
| default="blurry, low quality, flickering, motion blur, distorted", | |
| ) | |
| parser.add_argument("--output", type=str, default="output.mp4") | |
| parser.add_argument("--width", type=int, default=768) | |
| parser.add_argument("--height", type=int, default=512) | |
| parser.add_argument("--num_frames", type=int, default=49) | |
| parser.add_argument("--steps", type=int, default=40) | |
| parser.add_argument("--guidance_scale", type=float, default=5.0) | |
| parser.add_argument("--fps", type=int, default=24) | |
| parser.add_argument("--seed", type=int, default=42) | |
| args = parser.parse_args() | |
| print(f"Loading model from: {args.model_path}") | |
| pipe = LTX2ImageToVideoPipeline.from_pretrained( | |
| args.model_path, torch_dtype=torch.bfloat16 | |
| ) | |
| pipe.enable_model_cpu_offload() | |
| image = load_image(args.image).convert("RGB") | |
| print(f"Input image: {args.image} ({image.size[0]}x{image.size[1]})") | |
| video, audio = pipe( | |
| image=image, | |
| prompt=args.prompt, | |
| negative_prompt=args.negative_prompt, | |
| height=args.height, | |
| width=args.width, | |
| num_frames=args.num_frames, | |
| frame_rate=args.fps, | |
| num_inference_steps=args.steps, | |
| guidance_scale=args.guidance_scale, | |
| generator=torch.manual_seed(args.seed), | |
| output_type="np", | |
| return_dict=False, | |
| ) | |
| encode_video( | |
| video[0][: args.num_frames], | |
| fps=args.fps, | |
| output_path=args.output, | |
| audio=audio[0].float().cpu(), | |
| audio_sample_rate=pipe.vocoder.config.output_sampling_rate, | |
| ) | |
| print(f"Saved to: {args.output}") | |