You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LTX-2 is a DiT-based audio-video foundation model designed to generate synchronized video and audio within a single model. It brings together the core building blocks of modern video generation, with open weights and a focus on practical, local execution.
21
+
[LTX-2](https://hf.co/papers/2601.03233) is a DiT-based foundation model designed to generate synchronized video and audio within a single model. It brings together the core building blocks of modern video generation, with open weights and a focus on practical, local execution.
22
22
23
23
You can find all the original LTX-Video checkpoints under the [Lightricks](https://huggingface.co/Lightricks) organization.
24
24
@@ -293,6 +293,7 @@ import torch
293
293
from diffusers import LTX2ConditionPipeline
294
294
from diffusers.pipelines.ltx2.pipeline_ltx2_condition import LTX2VideoCondition
295
295
from diffusers.pipelines.ltx2.export_utils import encode_video
296
+
from diffusers.pipelines.ltx2.utils importDEFAULT_NEGATIVE_PROMPT
296
297
from diffusers.utils import load_image, load_video
297
298
298
299
device ="cuda"
@@ -315,19 +316,6 @@ prompt = (
315
316
"landscape is characterized by rugged terrain and a river visible in the distance. The scene captures the "
316
317
"solitude and beauty of a winter drive through a mountainous region."
317
318
)
318
-
negative_prompt = (
319
-
"blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, "
Because the conditioning is done via latent frames, the 8 data space frames corresponding to the specified latent frame for an image condition will tend to be static.
368
356
357
+
## Multimodal Guidance
358
+
359
+
LTX-2.X pipelines support multimodal guidance. It is composed of three terms, all using a CFG-style update rule:
360
+
361
+
1. Classifier-Free Guidance (CFG): standard [CFG](https://huggingface.co/papers/2207.12598) where the perturbed ("weaker") output is generated using the negative prompt.
362
+
2. Spatio-Temporal Guidance (STG): [STG](https://huggingface.co/papers/2411.18664) moves away from a perturbed output created from short-cutting self-attention operations and substitutes in the attention values instead. The idea is that this creates sharper videos and better spatiotemporal consistency.
363
+
3. Modality Isolation Guidance: moves away from a perturbed output created from disabling cross-modality (audio-to-video and video-to-audio) cross attention. This guidance is more specific to [LTX-2.X](https://huggingface.co/papers/2601.03233) models, with the idea that this produces better consistency between the generated audio and video.
364
+
365
+
These are controlled by the `guidance_scale`, `stg_scale`, and `modality_scale` arguments and can be set separately for video and audio. Additionally, for STG the transformer block indices where self-attention is skipped needs to be specified via the `spatio_temporal_guidance_blocks` argument. The LTX-2.X pipelines also support [guidance rescaling](https://huggingface.co/papers/2305.08891) to help reduce over-exposure, which can be a problem when the guidance scales are set to high values.
366
+
367
+
```py
368
+
import torch
369
+
from diffusers import LTX2ImageToVideoPipeline
370
+
from diffusers.pipelines.ltx2.export_utils import encode_video
371
+
from diffusers.pipelines.ltx2.utils importDEFAULT_NEGATIVE_PROMPT
The LTX-2.X models are sensitive to prompting style. Refer to the [official prompting guide](https://ltx.io/model/model-blog/prompting-guide-for-ltx-2) for recommendations on how to write a good prompt. Using prompt enhancement, where the supplied prompts are enhanced using the pipeline's text encoder (by default a [Gemma 3](https://huggingface.co/google/gemma-3-12b-it-qat-q4_0-unquantized) model) given a system prompt, can also improve sample quality. The optional `processor` pipeline component needs to be present to use prompt enhancement. Enable prompt enhancement by supplying a `system_prompt` argument:
437
+
438
+
439
+
```py
440
+
import torch
441
+
from transformers import Gemma3Processor
442
+
from diffusers import LTX2Pipeline
443
+
from diffusers.pipelines.ltx2.export_utils import encode_video
444
+
from diffusers.pipelines.ltx2.utils importDEFAULT_NEGATIVE_PROMPT, T2V_DEFAULT_SYSTEM_PROMPT
@@ -91,18 +74,15 @@ Weight-only quantization stores the model weights in a specific low-bit data typ
91
74
92
75
Dynamic activation quantization stores the model weights in a low-bit dtype, while also quantizing the activations on-the-fly to save additional memory. This lowers the memory requirements from model weights, while also lowering the memory overhead from activation computations. However, this may come at a quality tradeoff at times, so it is recommended to test different models thoroughly.
93
76
94
-
The quantization methods supported are as follows:
77
+
Refer to the [official torchao documentation](https://docs.pytorch.org/ao/stable/index.html) for a better understanding of the available quantization methods. An exhaustive list of configuration options are available [here](https://docs.pytorch.org/ao/main/workflows/inference.html#inference-workflows).
95
78
96
-
|**Category**|**Full Function Names**|**Shorthands**|
|**Floating point X-bit quantization**|`fpx_weight_only`|`fpX_eAwB` where `X` is the number of bits (1-7), `A` is exponent bits, and `B` is mantissa bits. Constraint: `X == A + B + 1`|
Some example popular quantization configurations are as follows:
102
80
103
-
Some quantization methods are aliases (for example, `int8wo` is the commonly used shorthand for `int8_weight_only`). This allows using the quantization methods described in the torchao docs as-is, while also making it convenient to remember their shorthand notations.
104
-
105
-
Refer to the [official torchao documentation](https://docs.pytorch.org/ao/stable/index.html) for a better understanding of the available quantization methods and the exhaustive list of configuration options available.
|**Floating point 8-bit quantization**|[`Float8WeightOnlyConfig`](https://docs.pytorch.org/ao/stable/api_reference/generated/torchao.quantization.Float8WeightOnlyConfig.html), [`Float8DynamicActivationFloat8WeightConfig`](https://docs.pytorch.org/ao/stable/api_reference/generated/torchao.quantization.Float8DynamicActivationFloat8WeightConfig.html)|
If you are using `torch<=2.6.0`, some quantization methods, such as `uint4wo`, cannot be loaded directly and may result in an `UnpicklingError` when trying to load the models, but work as expected when saving them. In order to work around this, one can load the state dict manually into the model. Note, however, that this requires using `weights_only=False` in `torch.load`, so it should be run only if the weights were obtained from a trustable source.
121
+
If you are using `torch<=2.6.0`, some quantization methods, such as `uint4` weight-only, cannot be loaded directly and may result in an `UnpicklingError` when trying to load the models, but work as expected when saving them. In order to work around this, one can load the state dict manually into the model. Note, however, that this requires using `weights_only=False` in `torch.load`, so it should be run only if the weights were obtained from a trustable source.
141
122
142
123
```python
143
124
import torch
144
125
from accelerate import init_empty_weights
145
126
from diffusers import FluxPipeline, AutoModel, TorchAoConfig
127
+
from torchao.quantization import IntxWeightOnlyConfig
0 commit comments