Skip to content

Conversation

@dg845
Copy link
Collaborator

@dg845 dg845 commented Jan 16, 2026

What does this PR do?

This PR adds single file / GGUF support for the LTX 2 video model.

Example script using GGUF files from unsloth/LTX-2-GGUF:

import os
import torch
from diffusers import GGUFQuantizationConfig, LTX2Pipeline, LTX2VideoTransformer3DModel
from diffusers.pipelines.ltx2.export_utils import encode_video

model_id = "Lightricks/LTX-2"
single_file_ckpt = "https://huggingface.co/unsloth/LTX-2-GGUF/blob/main/ltx-2-19b-dev-BF16.gguf"

device = "cuda:0"
dtype = torch.bfloat16
seed = 42

transformer_kwargs = {}
_, single_file_ext = os.path.splitext(single_file_ckpt)
if single_file_ext == ".gguf":
    quantization_config = GGUFQuantizationConfig(compute_dtype=dtype)
    transformer_kwargs["quantization_config"] = quantization_config

transformer = LTX2VideoTransformer3DModel.from_single_file(
    single_file_ckpt,
    config=model_id,
    subfolder="transformer",
    **transformer_kwargs,
)

pipe = LTX2Pipeline.from_pretrained(
    model_id,
    transformer=transformer,
    torch_dtype=dtype,
)
pipe.enable_model_cpu_offload(device=device)

prompt = "a dog dancing to energetic electronic dance music"
negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"
frame_rate = 24.0

video, audio = pipe(
    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,
    generator=torch.Generator().manual_seed(seed),
    output_type="np",
    return_dict=False,
)
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_t2v_single_file.mp4",
)

Fixes #12981

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@sayakpaul
@DN6
@AmericanPresidentJimmyCarter

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@dg845 dg845 requested review from DN6 and sayakpaul January 16, 2026 01:50
Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

Copy link
Collaborator

@DN6 DN6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍🏽

@dg845
Copy link
Collaborator Author

dg845 commented Jan 16, 2026

Merging as the failing tests are unrelated.

@dg845 dg845 merged commit 8af8e86 into main Jan 16, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems loading LTX-2 transformer GGUFs

5 participants