dg845 commited on
Commit
f4f570c
·
verified ·
1 Parent(s): 92c795d

Upload LTX25ModularPipeline

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: diffusers
3
+ tags:
4
+ - modular-diffusers
5
+ - diffusers
6
+ - ltx2.5
7
+ ---
8
+ This is a modular diffusion pipeline built with 🧨 Diffusers' modular pipeline framework.
9
+
10
+ **Pipeline Type**: LTX25AutoBlocks
11
+
12
+ **Description**: Auto blocks for LTX-2.5 supporting text-to-video, image-to-video, condition-to-video and in-context (IC-LoRA) generation (joint video + audio). Identical to `LTX2AutoBlocks` except that the video decoder is `LTX2DiffusionVaeDecoderStep`, since the diffusion decoder is the native default from LTX-2.5 on. To decode with the convolutional VAE instead, swap the decode block: `blocks.sub_blocks["decode"] = LTX2AutoDecoderStep()`.
13
+
14
+ This pipeline uses a 8-block architecture that can be customized and extended.
15
+
16
+ ## Example Usage
17
+
18
+ [TODO]
19
+
20
+ ## Pipeline Architecture
21
+
22
+ This modular pipeline is composed of the following blocks:
23
+
24
+ 1. **prompt_enhancer** (`LTX2AutoPromptEnhancerStep`)
25
+ - Conditional prompt-enhancer step, run only when `enable_prompt_enhancement` is truthy.
26
+ 2. **text_encoder** (`LTX2TextConditioningStep`)
27
+ - Text-conditioning stage for LTX-2.X: encodes the prompt(s), then runs the text connectors to produce the video/audio-branch connector embeddings the denoiser consumes. Outputs stay at one row per prompt -- the denoise stage expands them by `num_videos_per_prompt` -- so they can be reused across denoise runs.
28
+ 3. **duration** (`LTX2AutoDurationStep`)
29
+ - Conditional duration-prediction step, run only when `num_frames` is omitted.
30
+ 4. **vae_encoder** (`LTX2AutoVaeEncoderStep`)
31
+ - VAE encoder step that encodes the reference `image` into latents for image-to-video.
32
+ 5. **condition_encoder** (`LTX2AutoConditionEncoderStep`)
33
+ - Conditional condition-encoder step, run only for the condition and in-context workflows.
34
+ 6. **reference_encoder** (`LTX2AutoReferenceEncoderStep`)
35
+ - Conditional reference-encoder step, run only when `reference_conditions` are supplied.
36
+ 7. **denoise** (`LTX2AutoCoreDenoiseStep`)
37
+ - Auto denoise block that selects the workflow based on inputs.
38
+ 8. **decode** (`LTX25AutoDecoderStep`)
39
+ - Auto decode block for LTX-2.5 that selects the decoder based on inputs.
40
+
41
+ ## Model Components
42
+
43
+ 1. prompt_enhancer (`PreTrainedModel`)
44
+ 2. processor (`ProcessorMixin`)
45
+ 3. text_encoder (`PreTrainedModel`)
46
+ 4. tokenizer (`PreTrainedTokenizerBase`)
47
+ 5. connectors (`LTX2TextConnectors`)
48
+ 6. duration_head (`LTX2DurationHead`)
49
+ 7. vae (`AutoencoderKLLTX2Video`)
50
+ 8. video_processor (`VideoProcessor`)
51
+ 9. transformer (`LTX2VideoTransformer3DModel`)
52
+ 10. scheduler (`FlowMatchEulerDiscreteScheduler`)
53
+ 11. audio_vae (`AutoencoderKLLTX2Audio`)
54
+ 12. guider (`LTX2Guidance`)
55
+ 13. audio_guider (`LTX2Guidance`)
56
+ 14. diffusion_decoder (`LTX2VideoDiffusionDecoderModel`)
57
+ 15. vocoder (`LTX2Vocoder`)
58
+
59
+ ## Workflow Input Specification
60
+
61
+ <details>
62
+ <summary><strong>text2video</strong></summary>
63
+
64
+ - `prompt` (`str`): The prompt or prompts to guide image generation.
65
+
66
+ </details>
67
+
68
+ <details>
69
+ <summary><strong>image2video</strong></summary>
70
+
71
+ - `prompt` (`str`): The prompt or prompts to guide image generation.
72
+ - `image` (`Image | list`): Reference image(s) for denoising. Can be a single image or list of images.
73
+
74
+ </details>
75
+
76
+ <details>
77
+ <summary><strong>condition</strong></summary>
78
+
79
+ - `prompt` (`str`): The prompt or prompts to guide image generation.
80
+ - `conditions` (`list`, *optional*): `LTX2VideoCondition` (or list of them) placing image/video conditions at latent frame indices of the generated video.
81
+
82
+ </details>
83
+
84
+ <details>
85
+ <summary><strong>in_context</strong></summary>
86
+
87
+ - `prompt` (`str`): The prompt or prompts to guide image generation.
88
+ - `num_frames` (`int`, *optional*): The number of frames in the generated video. Omit to auto-predict via the `duration_head` (see `LTX2AutoDurationStep`).
89
+ - `reference_conditions` (`list`): `LTX2ReferenceCondition` (or list of them) whose videos are encoded into extra latent tokens the IC-LoRA adapter attends to.
90
+
91
+ </details>
92
+
93
+
94
+ ## Input/Output Specification
95
+
96
+ **Inputs:**
97
+
98
+ - `prompt` (`str`, *optional*): The prompt or prompts to guide image generation.
99
+ - `conditions` (`list`, *optional*): `LTX2VideoCondition` (or list of them) placing image/video conditions at latent frame indices of the generated video.
100
+ - `enable_prompt_enhancement` (`bool`, *optional*, defaults to `False`): Whether to run the prompt enhancer. Opt-in, matching the Lightricks reference pipelines.
101
+ - `system_prompt` (`str`, *optional*): System prompt for enhancement. Defaults to `LTX2_5_I2V_DEFAULT_SYSTEM_PROMPT` when a `PIL.Image.Image` condition frame is available, else `LTX2_5_T2V_DEFAULT_SYSTEM_PROMPT`.
102
+ - `prompt_max_new_tokens` (`int`, *optional*): Maximum number of new tokens to generate during prompt enhancement. Defaults to 600, the LTX-2.5 Gemma-4 enhancer's budget.
103
+ - `prompt_enhancement_kwargs` (`dict`, *optional*): Keyword arguments for the enhancer's `.generate` call. Defaults to greedy decoding.
104
+ - `prompt_enhancement_seed` (`int`, *optional*, defaults to `10`): Random seed for prompt enhancement (inert under LTX-2.5's greedy decoding).
105
+ - `generator` (`Generator`, *optional*): Torch generator for deterministic generation.
106
+ - `image` (`Image | list`, *optional*): Reference image(s) for denoising. Can be a single image or list of images.
107
+ - `negative_prompt` (`str`, *optional*): The prompt or prompts not to guide the image generation.
108
+ - `max_sequence_length` (`int`, *optional*, defaults to `1024`): Maximum sequence length for prompt encoding.
109
+ - `min_seconds` (`float`, *optional*, defaults to `1.0`): Lower bound on the auto-predicted duration.
110
+ - `max_seconds` (`float`, *optional*, defaults to `20.0`): Upper bound on the auto-predicted duration. Must be strictly greater than `min_seconds`.
111
+ - `frame_rate` (`float`, *optional*, defaults to `24.0`): Frames per second of the generated video.
112
+ - `height` (`int`, *optional*, defaults to `512`): The height in pixels of the generated image.
113
+ - `width` (`int`, *optional*, defaults to `704`): The width in pixels of the generated image.
114
+ - `image_crf` (`int`, *optional*): H.264 CRF used to re-compress the conditioning `image` before VAE encode, matching the compression the model was trained against. `None` (default) resolves from the text-encoder generation (33 through LTX-2.3, 18 for LTX-2.5). Pass `0` to skip re-compression. Requires a `PIL.Image.Image` when re-compression runs.
115
+ - `num_frames` (`int`, *optional*): The number of frames in the generated video. Omit to auto-predict via the `duration_head` (see `LTX2AutoDurationStep`).
116
+ - `reference_conditions` (`list`, *optional*): `LTX2ReferenceCondition` (or list of them) whose videos are encoded into extra latent tokens the IC-LoRA adapter attends to.
117
+ - `reference_downscale_factor` (`int`, *optional*, defaults to `1`): Ratio between the target and reference resolutions; 2 means the reference is preprocessed at half the target resolution. Spatial coordinates are scaled by this factor so the reference tokens land in the target coordinate space. Must match the factor the IC-LoRA was trained with.
118
+ - `conditioning_attention_strength` (`float`, *optional*, defaults to `1.0`): Scalar in [0, 1] controlling how strongly the noisy tokens and reference tokens attend to each other. 1.0 (default) leaves attention unmasked.
119
+ - `conditioning_attention_mask` (`Tensor`, *optional*): Optional pixel-space mask of shape (1, 1, F, H, W) with values in [0, 1] giving spatially varying attention strength. Downsampled to the reference's latent grid and multiplied by `conditioning_attention_strength`.
120
+ - `num_videos_per_prompt` (`int`, *optional*, defaults to `1`): The number of images to generate per prompt.
121
+ - `condition_latents` (`list`, *optional*): Per-condition normalized VAE latents of shape [1, C, F, H, W].
122
+ - `condition_strengths` (`list`, *optional*): Per-condition conditioning strengths.
123
+ - `condition_indices` (`list`, *optional*): Per-condition latent frame index at which the condition is applied.
124
+ - `condition_pixel_frames` (`list`, *optional*): Per-condition trimmed pixel frame count, used to clamp single-frame keyframe coords.
125
+ - `reference_latents` (`Tensor`, *optional*): Packed reference tokens of shape [1, total_reference_tokens, C], or `None` when no reference conditions were supplied (`LTX2AutoReferenceEncoderStep` is skipped).
126
+ - `reference_coords` (`Tensor`, *optional*): RoPE coordinates for the reference tokens.
127
+ - `reference_token_counts` (`list`, *optional*): Per-reference token counts, in `reference_conditions` order.
128
+ - `latents` (`Tensor`): Pre-generated noisy latents for image generation.
129
+ - `noise_scale` (`float`, *optional*): Initial noise level for the un-conditioned tokens. `None` (default) resolves to `sigmas[0]` when custom `sigmas` are supplied, else 1.0.
130
+ - `sigmas` (`list`, *optional*): Custom sigmas for the denoising process.
131
+ - `reference_cross_mask` (`Tensor`, *optional*): Per-reference-token noisy<->reference attention strengths of shape [1, num_ref_tokens].
132
+ - `num_inference_steps` (`int`): The number of denoising steps.
133
+ - `timesteps` (`Tensor`): Timesteps for the denoising process.
134
+ - `audio_latents` (`Tensor`): Optional pre-encoded audio latents; random noise is used when not provided.
135
+ - `**denoiser_input_fields` (`None`, *optional*): conditional model inputs for the denoiser: e.g. prompt_embeds, negative_prompt_embeds, etc.
136
+ - `use_cross_timestep` (`bool`, *optional*, defaults to `True`): Whether to condition the transformer on a separate per-token cross timestep (LTX-2.3+).
137
+ - `attention_kwargs` (`dict`, *optional*): Additional kwargs for attention processors.
138
+ - `image_latents` (`Tensor`, *optional*): VAE-encoded reference-image latents used for image-to-video conditioning.
139
+ - `output_type` (`str`, *optional*, defaults to `pil`): Output format: 'pil', 'np', 'pt'.
140
+
141
+ **Outputs:**
142
+
143
+ - `videos` (`list`): The generated videos.
144
+ - `audio` (`Tensor`): The generated audio waveform.
audio_vae/config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "AutoencoderKLLTX2Audio",
3
+ "_diffusers_version": "0.40.0.dev0",
4
+ "_name_or_path": "hf-internal-testing/tiny-ltx2-modular-pipe",
5
+ "attn_resolutions": null,
6
+ "base_channels": 4,
7
+ "causality_axis": "height",
8
+ "ch_mult": [
9
+ 1
10
+ ],
11
+ "double_z": true,
12
+ "dropout": 0.0,
13
+ "in_channels": 2,
14
+ "is_causal": true,
15
+ "latent_channels": 2,
16
+ "mel_bins": 8,
17
+ "mel_hop_length": 160,
18
+ "mid_block_add_attention": false,
19
+ "norm_type": "pixel",
20
+ "num_res_blocks": 1,
21
+ "output_channels": 2,
22
+ "resolution": 32,
23
+ "sample_rate": 16000
24
+ }
audio_vae/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a86c1d8d653163146e3e1c6e5f4365ba23edb41993640b9f4458d39950862610
3
+ size 13416
connectors/config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "LTX2TextConnectors",
3
+ "_diffusers_version": "0.40.0.dev0",
4
+ "_name_or_path": "hf-internal-testing/tiny-ltx2-modular-pipe",
5
+ "audio_connector_attention_head_dim": 8,
6
+ "audio_connector_num_attention_heads": 4,
7
+ "audio_connector_num_layers": 1,
8
+ "audio_connector_num_learnable_registers": null,
9
+ "audio_gated_attn": false,
10
+ "audio_hidden_dim": 2048,
11
+ "caption_channels": 32,
12
+ "causal_temporal_positioning": false,
13
+ "connector_rope_base_seq_len": 32,
14
+ "per_modality_projections": false,
15
+ "proj_bias": false,
16
+ "rope_double_precision": false,
17
+ "rope_theta": 10000.0,
18
+ "rope_type": "split",
19
+ "text_proj_in_factor": 3,
20
+ "video_connector_attention_head_dim": 8,
21
+ "video_connector_num_attention_heads": 4,
22
+ "video_connector_num_layers": 1,
23
+ "video_connector_num_learnable_registers": null,
24
+ "video_gated_attn": false,
25
+ "video_hidden_dim": 4096
26
+ }
connectors/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf8b2f822740f1cc4cbad5462b9679dc7c1ff1a9138080d08ae432d17e51d01d
3
+ size 116776
diffusion_decoder/config.json ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "LTX2VideoDiffusionDecoderModel",
3
+ "_diffusers_version": "0.40.0.dev0",
4
+ "decoder_head_dim": 8,
5
+ "decoder_model_output_type": "x0",
6
+ "decoder_num_inference_steps": 1,
7
+ "decoder_stage5_kernel": [
8
+ 3,
9
+ 3,
10
+ 3
11
+ ],
12
+ "decoder_stage_channels": [
13
+ 16,
14
+ 16,
15
+ 16,
16
+ 16,
17
+ 16
18
+ ],
19
+ "decoder_stage_depths": [
20
+ 1,
21
+ 1,
22
+ 1,
23
+ 1,
24
+ 1
25
+ ],
26
+ "decoder_stage_kernels": [
27
+ [
28
+ 3,
29
+ 3,
30
+ 3
31
+ ],
32
+ [
33
+ 3,
34
+ 3,
35
+ 3
36
+ ],
37
+ [
38
+ 3,
39
+ 3,
40
+ 3
41
+ ],
42
+ [
43
+ 3,
44
+ 3,
45
+ 3
46
+ ]
47
+ ],
48
+ "decoder_t_emb_dim": 16,
49
+ "decoder_timestep_scale_multiplier": 1000.0,
50
+ "decoder_upsample_channel_reductions": [
51
+ 1,
52
+ 1,
53
+ 1,
54
+ 1
55
+ ],
56
+ "decoder_upsample_strides": [
57
+ [
58
+ 1,
59
+ 1,
60
+ 1
61
+ ],
62
+ [
63
+ 1,
64
+ 1,
65
+ 1
66
+ ],
67
+ [
68
+ 1,
69
+ 1,
70
+ 1
71
+ ],
72
+ [
73
+ 2,
74
+ 2,
75
+ 2
76
+ ]
77
+ ],
78
+ "latent_channels": 4,
79
+ "out_channels": 3,
80
+ "patch_size": 1,
81
+ "scaling_factor": 1.0,
82
+ "spatial_compression_ratio": 2,
83
+ "temporal_compression_ratio": 2
84
+ }
diffusion_decoder/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2222de9e6ced96ba9b89b22327554a7cb0708d50bdb4b8d2eb8f24b3fdbdec51
3
+ size 133692
duration_head/config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "LTX2DurationHead",
3
+ "_diffusers_version": "0.40.0.dev0",
4
+ "_name_or_path": "hf-internal-testing/tiny-ltx2-modular-pipe",
5
+ "audio_cross_attention_dim": 32,
6
+ "mlp_hidden_dim": 8,
7
+ "num_pooler_heads": 2,
8
+ "num_queries": 1,
9
+ "pooler_hidden_dim": 8,
10
+ "video_cross_attention_dim": 32
11
+ }
duration_head/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05f94cb25d576346d6ef09ac9f17eeb93656a816c0cfd9c59c0c629da2399aa7
3
+ size 5260
modular_model_index.json ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_blocks_class_name": "LTX25AutoBlocks",
3
+ "_class_name": "LTX25ModularPipeline",
4
+ "_diffusers_version": "0.40.0.dev0",
5
+ "audio_vae": [
6
+ "diffusers",
7
+ "AutoencoderKLLTX2Audio",
8
+ {
9
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
10
+ "revision": null,
11
+ "subfolder": "audio_vae",
12
+ "type_hint": [
13
+ "diffusers",
14
+ "AutoencoderKLLTX2Audio"
15
+ ],
16
+ "variant": null
17
+ }
18
+ ],
19
+ "connectors": [
20
+ "ltx2",
21
+ "LTX2TextConnectors",
22
+ {
23
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
24
+ "revision": null,
25
+ "subfolder": "connectors",
26
+ "type_hint": [
27
+ "ltx2",
28
+ "LTX2TextConnectors"
29
+ ],
30
+ "variant": null
31
+ }
32
+ ],
33
+ "diffusion_decoder": [
34
+ "diffusers",
35
+ "LTX2VideoDiffusionDecoderModel",
36
+ {
37
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
38
+ "revision": null,
39
+ "subfolder": "diffusion_decoder",
40
+ "type_hint": [
41
+ "diffusers",
42
+ "LTX2VideoDiffusionDecoderModel"
43
+ ],
44
+ "variant": null
45
+ }
46
+ ],
47
+ "duration_head": [
48
+ "ltx2",
49
+ "LTX2DurationHead",
50
+ {
51
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
52
+ "revision": null,
53
+ "subfolder": "duration_head",
54
+ "type_hint": [
55
+ "ltx2",
56
+ "LTX2DurationHead"
57
+ ],
58
+ "variant": null
59
+ }
60
+ ],
61
+ "processor": [
62
+ null,
63
+ null,
64
+ {
65
+ "pretrained_model_name_or_path": null,
66
+ "revision": null,
67
+ "subfolder": "",
68
+ "type_hint": [
69
+ "transformers",
70
+ "ProcessorMixin"
71
+ ],
72
+ "variant": null
73
+ }
74
+ ],
75
+ "prompt_enhancer": [
76
+ null,
77
+ null,
78
+ {
79
+ "pretrained_model_name_or_path": null,
80
+ "revision": null,
81
+ "subfolder": "",
82
+ "type_hint": [
83
+ "transformers",
84
+ "PreTrainedModel"
85
+ ],
86
+ "variant": null
87
+ }
88
+ ],
89
+ "scheduler": [
90
+ "diffusers",
91
+ "FlowMatchEulerDiscreteScheduler",
92
+ {
93
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
94
+ "revision": null,
95
+ "subfolder": "scheduler",
96
+ "type_hint": [
97
+ "diffusers",
98
+ "FlowMatchEulerDiscreteScheduler"
99
+ ],
100
+ "variant": null
101
+ }
102
+ ],
103
+ "text_encoder": [
104
+ "transformers",
105
+ "Gemma3ForConditionalGeneration",
106
+ {
107
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
108
+ "revision": null,
109
+ "subfolder": "text_encoder",
110
+ "type_hint": [
111
+ "transformers",
112
+ "Gemma3ForConditionalGeneration"
113
+ ],
114
+ "variant": null
115
+ }
116
+ ],
117
+ "tokenizer": [
118
+ "transformers",
119
+ "GemmaTokenizer",
120
+ {
121
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
122
+ "revision": null,
123
+ "subfolder": "tokenizer",
124
+ "type_hint": [
125
+ "transformers",
126
+ "GemmaTokenizer"
127
+ ],
128
+ "variant": null
129
+ }
130
+ ],
131
+ "transformer": [
132
+ "diffusers",
133
+ "LTX2VideoTransformer3DModel",
134
+ {
135
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
136
+ "revision": null,
137
+ "subfolder": "transformer",
138
+ "type_hint": [
139
+ "diffusers",
140
+ "LTX2VideoTransformer3DModel"
141
+ ],
142
+ "variant": null
143
+ }
144
+ ],
145
+ "vae": [
146
+ "diffusers",
147
+ "AutoencoderKLLTX2Video",
148
+ {
149
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
150
+ "revision": null,
151
+ "subfolder": "vae",
152
+ "type_hint": [
153
+ "diffusers",
154
+ "AutoencoderKLLTX2Video"
155
+ ],
156
+ "variant": null
157
+ }
158
+ ],
159
+ "vocoder": [
160
+ "ltx2",
161
+ "LTX2Vocoder",
162
+ {
163
+ "pretrained_model_name_or_path": "hf-internal-testing/tiny-ltx2-5-modular-pipe",
164
+ "revision": null,
165
+ "subfolder": "vocoder",
166
+ "type_hint": [
167
+ "ltx2",
168
+ "LTX2Vocoder"
169
+ ],
170
+ "variant": null
171
+ }
172
+ ]
173
+ }
scheduler/scheduler_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "FlowMatchEulerDiscreteScheduler",
3
+ "_diffusers_version": "0.40.0.dev0",
4
+ "base_image_seq_len": 256,
5
+ "base_shift": 0.5,
6
+ "invert_sigmas": false,
7
+ "max_image_seq_len": 4096,
8
+ "max_shift": 1.15,
9
+ "num_train_timesteps": 1000,
10
+ "shift": 1.0,
11
+ "shift_terminal": null,
12
+ "stochastic_sampling": false,
13
+ "time_shift_type": "exponential",
14
+ "use_beta_sigmas": false,
15
+ "use_dynamic_shifting": false,
16
+ "use_exponential_sigmas": false,
17
+ "use_karras_sigmas": false
18
+ }
text_encoder/config.json ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma3ForConditionalGeneration"
4
+ ],
5
+ "boi_token_index": 255999,
6
+ "dtype": "float32",
7
+ "eoi_token_index": 256000,
8
+ "eos_token_id": [
9
+ 1,
10
+ 106
11
+ ],
12
+ "image_token_index": 262144,
13
+ "initializer_range": 0.02,
14
+ "mm_tokens_per_image": 256,
15
+ "model_type": "gemma3",
16
+ "text_config": {
17
+ "_sliding_window_pattern": 2,
18
+ "attention_bias": false,
19
+ "attention_dropout": 0.0,
20
+ "attn_logit_softcapping": null,
21
+ "bos_token_id": 2,
22
+ "cache_implementation": "hybrid",
23
+ "dtype": "float32",
24
+ "eos_token_id": 1,
25
+ "final_logit_softcapping": null,
26
+ "head_dim": 32,
27
+ "hidden_activation": "gelu_pytorch_tanh",
28
+ "hidden_size": 32,
29
+ "initializer_range": 0.02,
30
+ "intermediate_size": 128,
31
+ "layer_types": [
32
+ "sliding_attention",
33
+ "full_attention"
34
+ ],
35
+ "max_position_embeddings": 131072,
36
+ "model_type": "gemma3_text",
37
+ "num_attention_heads": 1,
38
+ "num_hidden_layers": 2,
39
+ "num_key_value_heads": 1,
40
+ "pad_token_id": 0,
41
+ "query_pre_attn_scalar": 168,
42
+ "rms_norm_eps": 1e-06,
43
+ "rope_parameters": {
44
+ "full_attention": {
45
+ "factor": 8.0,
46
+ "rope_theta": 1000000.0,
47
+ "rope_type": "linear"
48
+ },
49
+ "sliding_attention": {
50
+ "rope_theta": 10000.0,
51
+ "rope_type": "default"
52
+ }
53
+ },
54
+ "sliding_window": 1024,
55
+ "sliding_window_pattern": 2,
56
+ "tie_word_embeddings": true,
57
+ "use_bidirectional_attention": false,
58
+ "use_cache": true,
59
+ "vocab_size": 262208
60
+ },
61
+ "tie_word_embeddings": true,
62
+ "transformers_version": "5.15.0",
63
+ "vision_config": {
64
+ "attention_dropout": 0.0,
65
+ "dtype": "float32",
66
+ "hidden_act": "gelu_pytorch_tanh",
67
+ "hidden_size": 32,
68
+ "image_size": 896,
69
+ "intermediate_size": 128,
70
+ "layer_norm_eps": 1e-06,
71
+ "model_type": "siglip_vision_model",
72
+ "num_attention_heads": 1,
73
+ "num_channels": 3,
74
+ "num_hidden_layers": 2,
75
+ "patch_size": 14,
76
+ "vision_use_head": false
77
+ }
78
+ }
text_encoder/generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 2,
4
+ "cache_implementation": "hybrid",
5
+ "eos_token_id": [
6
+ 1,
7
+ 106
8
+ ],
9
+ "pad_token_id": 0,
10
+ "transformers_version": "5.15.0"
11
+ }
text_encoder/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f2b2e38ee7aced4b332a26484feae78e3d809c0cec32b1bb2a50e62962d0614
3
+ size 34409608
tokenizer/chat_template.jinja ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}
2
+ {%- if messages[0]['role'] == 'system' -%}
3
+ {%- if messages[0]['content'] is string -%}
4
+ {%- set first_user_prefix = messages[0]['content'] + '
5
+
6
+ ' -%}
7
+ {%- else -%}
8
+ {%- set first_user_prefix = messages[0]['content'][0]['text'] + '
9
+
10
+ ' -%}
11
+ {%- endif -%}
12
+ {%- set loop_messages = messages[1:] -%}
13
+ {%- else -%}
14
+ {%- set first_user_prefix = "" -%}
15
+ {%- set loop_messages = messages -%}
16
+ {%- endif -%}
17
+ {%- for message in loop_messages -%}
18
+ {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
19
+ {{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
20
+ {%- endif -%}
21
+ {%- if (message['role'] == 'assistant') -%}
22
+ {%- set role = "model" -%}
23
+ {%- else -%}
24
+ {%- set role = message['role'] -%}
25
+ {%- endif -%}
26
+ {{ '<start_of_turn>' + role + '
27
+ ' + (first_user_prefix if loop.first else "") }}
28
+ {%- if message['content'] is string -%}
29
+ {{ message['content'] | trim }}
30
+ {%- elif message['content'] is iterable -%}
31
+ {%- for item in message['content'] -%}
32
+ {%- if item['type'] == 'image' -%}
33
+ {{ '<start_of_image>' }}
34
+ {%- elif item['type'] == 'text' -%}
35
+ {{ item['text'] | trim }}
36
+ {%- endif -%}
37
+ {%- endfor -%}
38
+ {%- else -%}
39
+ {{ raise_exception("Invalid content type") }}
40
+ {%- endif -%}
41
+ {{ '<end_of_turn>
42
+ ' }}
43
+ {%- endfor -%}
44
+ {%- if add_generation_prompt -%}
45
+ {{'<start_of_turn>model
46
+ '}}
47
+ {%- endif -%}
tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be966fdc945f0a849b2712f3e469802ee6997ab2df4e5a6f673956c41194619d
3
+ size 33384829
tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "boi_token": "<start_of_image>",
4
+ "bos_token": "<bos>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eoi_token": "<end_of_image>",
7
+ "eos_token": "<eos>",
8
+ "image_token": "<image_soft_token>",
9
+ "is_local": false,
10
+ "local_files_only": false,
11
+ "mask_token": "<mask>",
12
+ "model_max_length": 1000000000000000019884624838656,
13
+ "model_specific_special_tokens": {
14
+ "boi_token": "<start_of_image>",
15
+ "eoi_token": "<end_of_image>",
16
+ "image_token": "<image_soft_token>"
17
+ },
18
+ "pad_token": "<pad>",
19
+ "processor_class": "Gemma3Processor",
20
+ "sp_model_kwargs": null,
21
+ "spaces_between_special_tokens": false,
22
+ "tokenizer_class": "GemmaTokenizer",
23
+ "unk_token": "<unk>",
24
+ "use_default_system_prompt": false,
25
+ "variant": null
26
+ }
transformer/config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "LTX2VideoTransformer3DModel",
3
+ "_diffusers_version": "0.40.0.dev0",
4
+ "_name_or_path": "hf-internal-testing/tiny-ltx2-modular-pipe",
5
+ "activation_fn": "gelu-approximate",
6
+ "attention_bias": true,
7
+ "attention_head_dim": 8,
8
+ "attention_out_bias": true,
9
+ "audio_attention_head_dim": 4,
10
+ "audio_cross_attention_dim": 8,
11
+ "audio_cross_attn_mod": false,
12
+ "audio_ff_bias": true,
13
+ "audio_gated_attn": false,
14
+ "audio_hop_length": 160,
15
+ "audio_in_channels": 4,
16
+ "audio_num_attention_heads": 2,
17
+ "audio_out_channels": 4,
18
+ "audio_patch_size": 1,
19
+ "audio_patch_size_t": 1,
20
+ "audio_pos_embed_max_pos": 20,
21
+ "audio_sampling_rate": 16000,
22
+ "audio_scale_factor": 4,
23
+ "base_height": 2048,
24
+ "base_width": 2048,
25
+ "caption_channels": 32,
26
+ "causal_offset": 1,
27
+ "cross_attention_dim": 16,
28
+ "cross_attn_mod": false,
29
+ "cross_attn_timestep_scale_multiplier": 1000,
30
+ "ff_bias": true,
31
+ "gated_attn": false,
32
+ "in_channels": 4,
33
+ "norm_elementwise_affine": false,
34
+ "norm_eps": 1e-06,
35
+ "num_attention_heads": 2,
36
+ "num_layers": 2,
37
+ "out_channels": 4,
38
+ "patch_size": 1,
39
+ "patch_size_t": 1,
40
+ "perturbed_attn": false,
41
+ "pos_embed_max_pos": 20,
42
+ "qk_norm": "rms_norm_across_heads",
43
+ "rope_double_precision": false,
44
+ "rope_theta": 10000.0,
45
+ "rope_type": "split",
46
+ "timestep_scale_multiplier": 1000,
47
+ "use_keyframes_abs_pos_embedding": false,
48
+ "use_prompt_adaln_single": true,
49
+ "use_prompt_embeddings": true,
50
+ "vae_scale_factors": [
51
+ 8,
52
+ 32,
53
+ 32
54
+ ]
55
+ }
transformer/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:972d94425158a7c4b7b43594891c54d36e09dcaea9ddef2cec49d491ab0deb3a
3
+ size 173544
vae/config.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "AutoencoderKLLTX2Video",
3
+ "_diffusers_version": "0.40.0.dev0",
4
+ "_name_or_path": "hf-internal-testing/tiny-ltx2-modular-pipe",
5
+ "block_out_channels": [
6
+ 8
7
+ ],
8
+ "decoder_block_out_channels": [
9
+ 8
10
+ ],
11
+ "decoder_causal": false,
12
+ "decoder_inject_noise": [
13
+ false,
14
+ false
15
+ ],
16
+ "decoder_layers_per_block": [
17
+ 1,
18
+ 1
19
+ ],
20
+ "decoder_spatial_padding_mode": "reflect",
21
+ "decoder_spatio_temporal_scaling": [
22
+ true
23
+ ],
24
+ "down_block_types": [
25
+ "LTX2VideoDownBlock3D",
26
+ "LTX2VideoDownBlock3D",
27
+ "LTX2VideoDownBlock3D",
28
+ "LTX2VideoDownBlock3D"
29
+ ],
30
+ "downsample_type": [
31
+ "spatial"
32
+ ],
33
+ "encoder_causal": true,
34
+ "encoder_spatial_padding_mode": "zeros",
35
+ "in_channels": 3,
36
+ "latent_channels": 4,
37
+ "layers_per_block": [
38
+ 1
39
+ ],
40
+ "out_channels": 3,
41
+ "patch_size": 1,
42
+ "patch_size_t": 1,
43
+ "resnet_norm_eps": 1e-06,
44
+ "scaling_factor": 1.0,
45
+ "spatial_compression_ratio": null,
46
+ "spatio_temporal_scaling": [
47
+ true
48
+ ],
49
+ "temporal_compression_ratio": null,
50
+ "timestep_conditioning": false,
51
+ "upsample_factor": [
52
+ 1
53
+ ],
54
+ "upsample_residual": [
55
+ false
56
+ ],
57
+ "upsample_type": [
58
+ "spatiotemporal",
59
+ "spatiotemporal",
60
+ "spatiotemporal"
61
+ ]
62
+ }
vae/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:056241bb4b8a029713f5f71bbe3c5f904cdea378fab80ecbb2a8e7e9035140c8
3
+ size 116464
vocoder/config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "LTX2Vocoder",
3
+ "_diffusers_version": "0.40.0.dev0",
4
+ "_name_or_path": "hf-internal-testing/tiny-ltx2-modular-pipe",
5
+ "act_fn": "leaky_relu",
6
+ "antialias": false,
7
+ "antialias_kernel_size": 12,
8
+ "antialias_ratio": 2,
9
+ "final_act_fn": "tanh",
10
+ "final_bias": true,
11
+ "hidden_channels": 32,
12
+ "in_channels": 16,
13
+ "leaky_relu_negative_slope": 0.1,
14
+ "out_channels": 2,
15
+ "output_sampling_rate": 16000,
16
+ "resnet_dilations": [
17
+ [
18
+ 1,
19
+ 3,
20
+ 5
21
+ ]
22
+ ],
23
+ "resnet_kernel_sizes": [
24
+ 3
25
+ ],
26
+ "upsample_factors": [
27
+ 2,
28
+ 2
29
+ ],
30
+ "upsample_kernel_sizes": [
31
+ 4,
32
+ 4
33
+ ]
34
+ }
vocoder/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be58882aaf71ba653bb607eb160f025c3526a85b589770836a1169b513cfbb94
3
+ size 51616