--- pipeline_tag: image-to-video library_name: diffusers --- This repo contains a checkpoint for the `diffusers` [LTX-2](https://huggingface.co/Lightricks/LTX-2) latent upsampling pipeline `LTX2LatentUpsamplerModel`, which upsamples the first-stage video latents as part of two-stage inference. A usage example is as follows: ```python import torch from diffusers import LTX2ImageToVideoPipeline, LTX2LatentUpsamplePipeline from diffusers.pipelines.ltx2.export_utils import encode_video pipe = LTX2Pipeline.from_pretrained("Lightricks/LTX-2", torch_dtype=torch.bfloat16) pipe.enable_model_cpu_offload() image = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg" ) prompt = "An astronaut hatches from a fragile egg on the surface of the Moon, the shell cracking and peeling apart in gentle low-gravity motion. Fine lunar dust lifts and drifts outward with each movement, floating in slow arcs before settling back onto the ground. The astronaut pushes free in a deliberate, weightless motion, small fragments of the egg tumbling and spinning through the air. In the background, the deep darkness of space subtly shifts as stars glide with the camera's movement, emphasizing vast depth and scale. The camera performs a smooth, cinematic slow push-in, with natural parallax between the foreground dust, the astronaut, and the distant starfield. Ultra-realistic detail, physically accurate low-gravity motion, cinematic lighting, and a breath-taking, movie-like shot." negative_prompt = "shaky, glitchy, low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly, transition, static." # First-Stage I2V inference frame_rate = 24.0 video, audio = pipe( image=image, prompt=prompt, negative_prompt=negative_prompt, width=768, height=512, num_frames=121, frame_rate=frame_rate, num_inference_steps=40, guidance_scale=4.0, output_type="pil", return_dict=False, ) upsample_pipe = LTX2LatentUpsamplePipeline.from_pretrained( "dg845/LTX-2-Latent-Upsampler-Diffusers", torch_dtype=torch.bfloat16 ) upsample_pipe.vae.enable_tiling() upsample_pipe.to("cuda") # Latent Upsampling video = upsample_pipe( video=video, width=768, height=512, output_type="np", return_dict=False, )[0] video = (video * 255).round().astype("uint8") video = torch.from_numpy(video) encode_video( video[0], fps=frame_rate, audio=audio[0].float().cpu(), audio_sample_rate=pipe.vocoder.config.output_sampling_rate, output_path="ltx2_sample.mp4", ) ```