Skip to content
Python

improved ltx2 fp8 compatibility

DeepBeepMeep15d039a1424e
diff --git a/defaults/hunyuan_1_5_i2v.json b/defaults/hunyuan_1_5_i2v.json
index 740e44f..3d99202 100644
--- a/defaults/hunyuan_1_5_i2v.json
+++ b/defaults/hunyuan_1_5_i2v.json
@@ -11,6 +11,7 @@
"prompt" : "",
"resolution": "1280x720",
"video_length": 97,
+ "sliding_window_size": 97,
"num_inference_steps": 30,
"guidance_scale": 6.0,
"flow_shift": 7.0
diff --git a/defaults/hunyuan_1_5_t2v.json b/defaults/hunyuan_1_5_t2v.json
index 9a4f3a8..a0e0327 100644
--- a/defaults/hunyuan_1_5_t2v.json
+++ b/defaults/hunyuan_1_5_t2v.json
@@ -10,6 +10,7 @@
},
"resolution": "1280x720",
"video_length": 97,
+ "sliding_window_size": 97,
"num_inference_steps": 30,
"guidance_scale": 6.0,
"flow_shift": 9.0
diff --git a/defaults/hunyuan_1_5_upsampler.json b/defaults/hunyuan_1_5_upsampler.json
index 67501f5..8b1d8b9 100644
--- a/defaults/hunyuan_1_5_upsampler.json
+++ b/defaults/hunyuan_1_5_upsampler.json
@@ -16,6 +16,7 @@
},
"resolution": "1280x720",
"video_length": 97,
+ "sliding_window_size": 97,
"num_inference_steps": 6,
"guidance_scale": 1,
"flow_shift": 2.0
diff --git a/defaults/hunyuan_1_5_upsampler_1080.json b/defaults/hunyuan_1_5_upsampler_1080.json
index 0569acc..128b8da 100644
--- a/defaults/hunyuan_1_5_upsampler_1080.json
+++ b/defaults/hunyuan_1_5_upsampler_1080.json
@@ -16,6 +16,7 @@
},
"resolution": "1920x1088",
"video_length": 97,
+ "sliding_window_size": 97,
"num_inference_steps": 8,
"guidance_scale": 1,
"flow_shift": 2.0
diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md
index e75ee07..0c0aabc 100644
--- a/docs/INSTALLATION.md
+++ b/docs/INSTALLATION.md
@@ -356,5 +356,5 @@ These kernels will offer optimized INT4 / FP4 dequantization.
- Linux
```
- pip install https://github.com/nunchaku-ai/nunchaku/releases/download/v1.2.1/nunchaku-1.2.1+cu13.0torch2.10-cp310-cp310-linux_x86_64.whl
+ pip install https://github.com/nunchaku-ai/nunchaku/releases/download/v1.2.1/nunchaku-1.2.1+cu13.0torch2.10-cp311-cp311-linux_x86_64.whl
```
\ No newline at end of file
diff --git a/models/ltx2/ltx_core/model/transformer/model.py b/models/ltx2/ltx_core/model/transformer/model.py
index 708a6ca..ac2536c 100644
--- a/models/ltx2/ltx_core/model/transformer/model.py
+++ b/models/ltx2/ltx_core/model/transformer/model.py
@@ -267,6 +267,18 @@ class LTXModel(torch.nn.Module):
rope_type=self.rope_type,
)
+ def _refresh_preprocessor_refs(self) -> None:
+ if self.model_type.is_video_enabled():
+ if isinstance(self.video_args_preprocessor, MultiModalTransformerArgsPreprocessor):
+ self.video_args_preprocessor.simple_preprocessor.patchify_proj = self.patchify_proj
+ else:
+ self.video_args_preprocessor.patchify_proj = self.patchify_proj
+ if self.model_type.is_audio_enabled():
+ if isinstance(self.audio_args_preprocessor, MultiModalTransformerArgsPreprocessor):
+ self.audio_args_preprocessor.simple_preprocessor.patchify_proj = self.audio_patchify_proj
+ else:
+ self.audio_args_preprocessor.patchify_proj = self.audio_patchify_proj
+
def _init_transformer_blocks(
self,
num_layers: int,
@@ -418,6 +430,7 @@ class LTXModel(torch.nn.Module):
if not self.model_type.is_audio_enabled() and audio is not None:
raise ValueError("Audio is not enabled for this model")
+ self._refresh_preprocessor_refs()
self.interrupted = False
joint_pass = isinstance(video, (list, tuple)) or isinstance(audio, (list, tuple))
if joint_pass: