ofirbibi commited on
Commit
9b6bbe0
·
1 Parent(s): c8909ad

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +202 -0
README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-to-video
4
+ - text-to-video
5
+ - video-to-video
6
+ - image-text-to-video
7
+ - audio-to-video
8
+ - text-to-audio
9
+ - video-to-audio
10
+ - audio-to-audio
11
+ - text-to-audio-video
12
+ - image-to-audio-video
13
+ - image-text-to-audio-video
14
+ - ltx-2
15
+ - ltx-video
16
+ - ltxv
17
+ - lightricks
18
+ ---
19
+
20
+ # LTX-2 Model Card
21
+
22
+ This model card focuses on the LTX-2 model, as presented in the paper [LTX-2: Efficient Joint Audio-Visual Foundation Model](https://huggingface.co/papers/2601.03233). The codebase is available [here](https://github.com/Lightricks/LTX-2).
23
+
24
+ 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.
25
+
26
+ [![LTX-2 Open Source](https://img.youtube.com/vi/8fWAJXZJbRA/maxresdefault.jpg)](https://www.youtube.com/watch?v=8fWAJXZJbRA)
27
+
28
+ # Model Checkpoints
29
+
30
+ | Name | Notes |
31
+ |--------------------------------|----------------------------------------------------------------------------------------------------------------|
32
+ | ltx-2-19b-dev | The full model, flexible and trainable in bf16 |
33
+ | ltx-2-19b-dev-fp8 | The full model in fp8 quantization |
34
+ | ltx-2-19b-dev-fp4 | The full model in nvfp4 quantization |
35
+ | ltx-2-19b-distilled | The distilled version of the full model, 8 steps, CFG=1 |
36
+ | ltx-2-19b-distilled-lora-384 | A LoRA version of the distilled model applicable to the full model |
37
+ | ltx-2-spatial-upscaler-x2-1.0 | An x2 spatial upscaler for the ltx-2 latents, used in multi stage (multiscale) pipelines for higher resolution |
38
+ | ltx-2-temporal-upscaler-x2-1.0 | An x2 temporal upscaler for the ltx-2 latents, used in multi stage (multiscale) pipelines for higher FPS |
39
+
40
+ ## Model Details
41
+ - **Developed by:** Lightricks
42
+ - **Model type:** Diffusion-based audio-video foundation model
43
+ - **Language(s):** English
44
+
45
+ # Online demo
46
+ LTX-2 is accessible right away via the following links:
47
+ - [LTX-Studio text-to-video](https://app.ltx.studio/ltx-2-playground/t2v)
48
+ - [LTX-Studio image-to-video](https://app.ltx.studio/ltx-2-playground/i2v)
49
+
50
+ # Run locally
51
+
52
+ ## Direct use license
53
+ You can use the models - full, distilled, upscalers and any derivatives of the models - for purposes under the [license](./LICENSE).
54
+
55
+ ## ComfyUI
56
+ We recommend you use the built-in LTXVideo nodes that can be found in the ComfyUI Manager.
57
+ For manual installation information, please refer to our [documentation site](https://docs.ltx.video/open-source-model/integration-tools/comfy-ui).
58
+
59
+ ## PyTorch codebase
60
+
61
+ The [LTX-2 codebase](https://github.com/Lightricks/LTX-2) is a monorepo with several packages. From model definition in 'ltx-core' to pipelines in 'ltx-pipelines' and training capabilities in 'ltx-trainer'.
62
+ The codebase was tested with Python >=3.12, CUDA version >12.7, and supports PyTorch ~= 2.7.
63
+
64
+ ### Installation
65
+
66
+ ```bash
67
+ git clone https://github.com/Lightricks/LTX-2.git
68
+ cd LTX-2
69
+
70
+ # From the repository root
71
+ uv sync
72
+ source .venv/bin/activate
73
+ ```
74
+
75
+ ### Inference
76
+
77
+ To use our model, please follow the instructions in our [ltx-pipelines](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/README.md) package.
78
+
79
+ ## Diffusers 🧨
80
+
81
+ LTX-2 is supported in the [Diffusers Python library](https://huggingface.co/docs/diffusers/main/en/index) for text & image-to-video generation.
82
+ Read more on LTX-2 with diffusers [here](https://huggingface.co/docs/diffusers/main/en/api/pipelines/ltx2#diffusers.LTX2Pipeline.__call__.example).
83
+
84
+ ### Use with diffusers
85
+ To achieve production quality generation, it's recommended to use the two-stage generation pipeline.
86
+ Example for 2-stage inference of text-to-video:
87
+ ```python
88
+ import torch
89
+ from diffusers import FlowMatchEulerDiscreteScheduler
90
+ from diffusers.pipelines.ltx2 import LTX2Pipeline, LTX2LatentUpsamplePipeline
91
+ from diffusers.pipelines.ltx2.latent_upsampler import LTX2LatentUpsamplerModel
92
+ from diffusers.pipelines.ltx2.utils import STAGE_2_DISTILLED_SIGMA_VALUES
93
+ from diffusers.pipelines.ltx2.export_utils import encode_video
94
+
95
+ device = "cuda:0"
96
+ width = 768
97
+ height = 512
98
+
99
+ pipe = LTX2Pipeline.from_pretrained(
100
+ "Lightricks/LTX-2", torch_dtype=torch.bfloat16
101
+ )
102
+ pipe.enable_sequential_cpu_offload(device=device)
103
+
104
+ prompt = "A beautiful sunset over the ocean"
105
+ negative_prompt = "shaky, glitchy, low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly, transition, static."
106
+
107
+ # Stage 1 default (non-distilled) inference
108
+ frame_rate = 24.0
109
+ video_latent, audio_latent = pipe(
110
+ prompt=prompt,
111
+ negative_prompt=negative_prompt,
112
+ width=width,
113
+ height=height,
114
+ num_frames=121,
115
+ frame_rate=frame_rate,
116
+ num_inference_steps=40,
117
+ sigmas=None,
118
+ guidance_scale=4.0,
119
+ output_type="latent",
120
+ return_dict=False,
121
+ )
122
+
123
+ latent_upsampler = LTX2LatentUpsamplerModel.from_pretrained(
124
+ "Lightricks/LTX-2",
125
+ subfolder="latent_upsampler",
126
+ torch_dtype=torch.bfloat16,
127
+ )
128
+ upsample_pipe = LTX2LatentUpsamplePipeline(vae=pipe.vae, latent_upsampler=latent_upsampler)
129
+ upsample_pipe.enable_model_cpu_offload(device=device)
130
+ upscaled_video_latent = upsample_pipe(
131
+ latents=video_latent,
132
+ output_type="latent",
133
+ return_dict=False,
134
+ )[0]
135
+
136
+ # Load Stage 2 distilled LoRA
137
+ pipe.load_lora_weights(
138
+ "Lightricks/LTX-2", adapter_name="stage_2_distilled", weight_name="ltx-2-19b-distilled-lora-384.safetensors"
139
+ )
140
+ pipe.set_adapters("stage_2_distilled", 1.0)
141
+ # VAE tiling is usually necessary to avoid OOM error when VAE decoding
142
+ pipe.vae.enable_tiling()
143
+ # Change scheduler to use Stage 2 distilled sigmas as is
144
+ new_scheduler = FlowMatchEulerDiscreteScheduler.from_config(
145
+ pipe.scheduler.config, use_dynamic_shifting=False, shift_terminal=None
146
+ )
147
+ pipe.scheduler = new_scheduler
148
+ # Stage 2 inference with distilled LoRA and sigmas
149
+ video, audio = pipe(
150
+ latents=upscaled_video_latent,
151
+ audio_latents=audio_latent,
152
+ prompt=prompt,
153
+ negative_prompt=negative_prompt,
154
+ num_inference_steps=3,
155
+ noise_scale=STAGE_2_DISTILLED_SIGMA_VALUES[0], # renoise with first sigma value https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages.py#L218
156
+ sigmas=STAGE_2_DISTILLED_SIGMA_VALUES,
157
+ guidance_scale=1.0,
158
+ output_type="np",
159
+ return_dict=False,
160
+ )
161
+
162
+ encode_video(
163
+ video[0],
164
+ fps=frame_rate,
165
+ audio=audio[0].float().cpu(),
166
+ audio_sample_rate=pipe.vocoder.config.output_sampling_rate,
167
+ output_path="ltx2_lora_distilled_sample.mp4",
168
+ )
169
+ ```
170
+ For more inference examples, including generation with the distilled checkpoint, visit [here](https://huggingface.co/docs/diffusers/main/en/api/pipelines/ltx2#diffusers.LTX2Pipeline.__call__.example).
171
+
172
+ ## General tips:
173
+ * Width & height settings must be divisible by 32. Frame count must be divisible by 8 + 1.
174
+ * In case the resolution or number of frames are not divisible by 32 or 8 + 1, the input should be padded with -1 and then cropped to the desired resolution and number of frames.
175
+ * For tips on writing effective prompts, please visit our [Prompting guide](https://ltx.video/blog/how-to-prompt-for-ltx-2)
176
+
177
+ ### Limitations
178
+ - This model is not intended or able to provide factual information.
179
+ - As a statistical model this checkpoint might amplify existing societal biases.
180
+ - The model may fail to generate videos that matches the prompts perfectly.
181
+ - Prompt following is heavily influenced by the prompting-style.
182
+ - The model may generate content that is inappropriate or offensive.
183
+ - When generating audio without speech, the audio may be of lower quality.
184
+
185
+ # Train the model
186
+
187
+ The base (dev) model is fully trainable.
188
+
189
+ It's extremely easy to reproduce the LoRAs and IC-LoRAs we publish with the model by following the instructions on the [LTX-2 Trainer Readme](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-trainer/README.md).
190
+
191
+ Training for motion, style or likeness (sound+appearance) can take less than an hour in many settings.
192
+
193
+ ## Citation
194
+
195
+ ```bibtex
196
+ @article{hacohen2025ltx2,
197
+ title={LTX-2: Efficient Joint Audio-Visual Foundation Model},
198
+ author={HaCohen, Yoav and Brazowski, Benny and Chiprut, Nisan and Bitterman, Yaki and Kvochko, Andrew and Berkowitz, Avishai and Shalem, Daniel and Lifschitz, Daphna and Moshe, Dudu and Porat, Eitan and Richardson, Eitan and Guy Shiran and Itay Chachy and Jonathan Chetboun and Michael Finkelson and Michael Kupchick and Nir Zabari and Nitzan Guetta and Noa Kotler and Ofir Bibi and Ori Gordon and Poriya Panet and Roi Benita and Shahar Armon and Victor Kulikov and Yaron Inger and Yonatan Shiftan and Zeev Melumian and Zeev Farbman},
199
+ journal={arXiv preprint arXiv:2601.03233},
200
+ year={2025}
201
+ }
202
+ ```