Python
fixed ltx2 i2v VAE banding
DeepBeepMeepa931ec095737
diff --git a/models/ltx2/ltx2.py b/models/ltx2/ltx2.pyindex 0ba41b4..606ef9c 100644--- a/models/ltx2/ltx2.py+++ b/models/ltx2/ltx2.py@@ -1,3 +1,4 @@+import copyimport jsonimport mathimport os@@ -588,7 +589,12 @@ class LTX2:transformer.eval().requires_grad_(False)VAE_URLs = self.model_def.get("VAE_URLs", None)video_vae_path = fl.locate_file(VAE_URLs[0]) if VAE_URLs is not None and len(VAE_URLs) else _component_path("video_vae")- video_config = _component_config(video_vae_path)+ video_config = copy.deepcopy(_component_config(video_vae_path))+ video_config_vae = video_config.setdefault("vae", {})+ video_config_vae["spatial_padding_mode"] = "reflect"+ video_config_vae["encoder_spatial_padding_mode"] = "reflect"+ video_config_vae["decoder_spatial_padding_mode"] = "reflect"+ print("[LTX2 VAE Config] forcing encoder/decoder spatial_padding_mode=reflect")with init_empty_weights():video_encoder = VideoEncoderConfigurator.from_config(video_config)video_decoder = VideoDecoderConfigurator.from_config(video_config)diff --git a/models/ltx2/ltx_core/model/video_vae/video_vae.py b/models/ltx2/ltx_core/model/video_vae/video_vae.pyindex 2771c65..b546482 100644--- a/models/ltx2/ltx_core/model/video_vae/video_vae.py+++ b/models/ltx2/ltx_core/model/video_vae/video_vae.py@@ -1040,6 +1040,8 @@ def encode_video(tiling_config.spatial_config is None and tiling_config.temporal_config is None):return video_encoder(video)+ if video.shape[2] == 1 and tiling_config.spatial_config is not None:+ tiling_config = replace(tiling_config, spatial_config=None)b, _, frames, height, width = video.shapescale = VIDEO_SCALE_FACTORS