Views
No views yet

![]() | ![]() | ![]() |
![]() | ![]() | ![]() |
![]() | ![]() | ![]() |
| Name | Notes | inference.py config | ComfyUI workflow (Recommended) |
|---|---|---|---|
| ltxv-13b-0.9.8-dev | Highest quality, requires more VRAM | ltxv-13b-0.9.8-dev.yaml | ltxv-13b-i2v-base.json |
| ltxv-13b-0.9.8-mix | Mix ltxv-13b-dev and ltxv-13b-distilled in the same multi-scale rendering workflow for balanced speed-quality | N/A | ltxv-13b-i2v-mixed-multiscale.json |
| ltxv-13b-0.9.8-distilled | Faster, less VRAM usage, slight quality reduction compared to 13b. Ideal for rapid iterations | ltxv-13b-0.9.8-distilled.yaml | ltxv-13b-dist-i2v-base.json |
| ltxv-2b-0.9.8-distilled | Smaller model, slight quality reduction compared to 13b distilled. Ideal for light VRAM usage | ltxv-2b-0.9.8-distilled.yaml | N/A |
| ltxv-13b-0.9.8-fp8 | Quantized version of ltxv-13b | ltxv-13b-0.9.8-dev-fp8.yaml | ltxv-13b-i2v-base-fp8.json |
| ltxv-13b-0.9.8-distilled-fp8 | Quantized version of ltxv-13b-distilled | ltxv-13b-0.9.8-distilled-fp8.yaml | ltxv-13b-dist-i2v-base-fp8.json |
| ltxv-2b-0.9.8-distilled-fp8 | Quantized version of ltxv-2b-distilled | ltxv-2b-0.9.8-distilled-fp8.yaml | N/A |
| ltxv-2b-0.9.6 | Good quality, lower VRAM requirement than ltxv-13b | ltxv-2b-0.9.6-dev.yaml | ltxvideo-i2v.json |
| ltxv-2b-0.9.6-distilled | 15× faster, real-time capable, fewer steps needed, no STG/CFG required | ltxv-2b-0.9.6-distilled.yaml | ltxvideo-i2v-distilled.json |
The turquoise waves crash against the dark, jagged rocks of the shore, sending white foam spraying into the air. The scene is dominated by the stark contrast between the bright blue water and the dark, almost black rocks. The water is a clear, turquoise color, and the waves are capped with white foam. The rocks are dark and jagged, and they are covered in patches of green moss. The shore is lined with lush green vegetation, including trees and bushes. In the background, there are rolling hills covered in dense forest. The sky is cloudy, and the light is dim.1git clone https://github.com/Lightricks/LTX-Video.git
2cd LTX-Video
3
4# create env
5python -m venv env
6source env/bin/activate
7python -m pip install -e .\[inference-script\]python inference.py --prompt "PROMPT" --input_image_path IMAGE_PATH --height HEIGHT --width WIDTH --num_frames NUM_FRAMES --seed SEED --pipeline_config configs/ltxv-13b-0.9.8-distilled.yamlpython inference.py --prompt "PROMPT" --conditioning_media_paths IMAGE_OR_VIDEO_PATH_1 IMAGE_OR_VIDEO_PATH_2 --conditioning_start_frames TARGET_FRAME_1 TARGET_FRAME_2 --height HEIGHT --width WIDTH --num_frames NUM_FRAMES --seed SEED --pipeline_config configs/ltxv-13b-0.9.8-distilled.yamldiffusers before trying out the examples below.pip install -U git+https://github.com/huggingface/diffusers1import torch
2from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
3from diffusers.pipelines.ltx.pipeline_ltx_condition import LTXVideoCondition
4from diffusers.utils import export_to_video, load_image, load_video
5
6pipe = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.8-dev", torch_dtype=torch.bfloat16)
7pipe_upsample = LTXLatentUpsamplePipeline.from_pretrained("Lightricks/ltxv-spatial-upscaler-0.9.8", vae=pipe.vae, torch_dtype=torch.bfloat16)
8pipe.to("cuda")
9pipe_upsample.to("cuda")
10pipe.vae.enable_tiling()
11
12def round_to_nearest_resolution_acceptable_by_vae(height, width):
13 height = height - (height % pipe.vae_spatial_compression_ratio)
14 width = width - (width % pipe.vae_spatial_compression_ratio)
15 return height, width
16
17image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/penguin.png")
18video = load_video(export_to_video([image])) # compress the image using video compression as the model was trained on videos
19condition1 = LTXVideoCondition(video=video, frame_index=0)
20
21prompt = "A cute little penguin takes out a book and starts reading it"
22negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"
23expected_height, expected_width = 480, 832
24downscale_factor = 2 / 3
25num_frames = 96
26
27# Part 1. Generate video at smaller resolution
28downscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)
29downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
30latents = pipe(
31 conditions=[condition1],
32 prompt=prompt,
33 negative_prompt=negative_prompt,
34 width=downscaled_width,
35 height=downscaled_height,
36 num_frames=num_frames,
37 num_inference_steps=30,
38 generator=torch.Generator().manual_seed(0),
39 output_type="latent",
40).frames
41
42# Part 2. Upscale generated video using latent upsampler with fewer inference steps
43# The available latent upsampler upscales the height/width by 2x
44upscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2
45upscaled_latents = pipe_upsample(
46 latents=latents,
47 output_type="latent"
48).frames
49
50# Part 3. Denoise the upscaled video with few steps to improve texture (optional, but recommended)
51video = pipe(
52 conditions=[condition1],
53 prompt=prompt,
54 negative_prompt=negative_prompt,
55 width=upscaled_width,
56 height=upscaled_height,
57 num_frames=num_frames,
58 denoise_strength=0.4, # Effectively, 4 inference steps out of 10
59 num_inference_steps=10,
60 latents=upscaled_latents,
61 decode_timestep=0.05,
62 image_cond_noise_scale=0.025,
63 generator=torch.Generator().manual_seed(0),
64 output_type="pil",
65).frames[0]
66
67# Part 4. Downscale the video to the expected resolution
68video = [frame.resize((expected_width, expected_height)) for frame in video]
69
70export_to_video(video, "output.mp4", fps=24)1import torch
2from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
3from diffusers.pipelines.ltx.pipeline_ltx_condition import LTXVideoCondition
4from diffusers.utils import export_to_video, load_video
5
6pipe = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.8-dev", torch_dtype=torch.bfloat16)
7pipe_upsample = LTXLatentUpsamplePipeline.from_pretrained("Lightricks/ltxv-spatial-upscaler-0.9.8", vae=pipe.vae, torch_dtype=torch.bfloat16)
8pipe.to("cuda")
9pipe_upsample.to("cuda")
10pipe.vae.enable_tiling()
11
12def round_to_nearest_resolution_acceptable_by_vae(height, width):
13 height = height - (height % pipe.vae_spatial_compression_ratio)
14 width = width - (width % pipe.vae_spatial_compression_ratio)
15 return height, width
16
17video = load_video(
18 "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cosmos/cosmos-video2world-input-vid.mp4"
19)[:21] # Use only the first 21 frames as conditioning
20condition1 = LTXVideoCondition(video=video, frame_index=0)
21
22prompt = "The video depicts a winding mountain road covered in snow, with a single vehicle traveling along it. The road is flanked by steep, rocky cliffs and sparse vegetation. The landscape is characterized by rugged terrain and a river visible in the distance. The scene captures the solitude and beauty of a winter drive through a mountainous region."
23negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"
24expected_height, expected_width = 768, 1152
25downscale_factor = 2 / 3
26num_frames = 161
27
28# Part 1. Generate video at smaller resolution
29downscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)
30downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
31latents = pipe(
32 conditions=[condition1],
33 prompt=prompt,
34 negative_prompt=negative_prompt,
35 width=downscaled_width,
36 height=downscaled_height,
37 num_frames=num_frames,
38 num_inference_steps=30,
39 generator=torch.Generator().manual_seed(0),
40 output_type="latent",
41).frames
42
43# Part 2. Upscale generated video using latent upsampler with fewer inference steps
44# The available latent upsampler upscales the height/width by 2x
45upscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2
46upscaled_latents = pipe_upsample(
47 latents=latents,
48 output_type="latent"
49).frames
50
51# Part 3. Denoise the upscaled video with few steps to improve texture (optional, but recommended)
52video = pipe(
53 conditions=[condition1],
54 prompt=prompt,
55 negative_prompt=negative_prompt,
56 width=upscaled_width,
57 height=upscaled_height,
58 num_frames=num_frames,
59 denoise_strength=0.4, # Effectively, 4 inference steps out of 10
60 num_inference_steps=10,
61 latents=upscaled_latents,
62 decode_timestep=0.05,
63 image_cond_noise_scale=0.025,
64 generator=torch.Generator().manual_seed(0),
65 output_type="pil",
66).frames[0]
67
68# Part 4. Downscale the video to the expected resolution
69video = [frame.resize((expected_width, expected_height)) for frame in video]
70
71export_to_video(video, "output.mp4", fps=24)from_single_file() method. Check out this section to learn more.