Update latent_enhancer_specialist.py
Browse files
latent_enhancer_specialist.py
CHANGED
|
@@ -25,7 +25,6 @@ class LatentEnhancerSpecialist:
|
|
| 25 |
if self.pipe_upsample is not None:
|
| 26 |
return
|
| 27 |
try:
|
| 28 |
-
# A pipeline de upscale requer um VAE específico
|
| 29 |
from diffusers.models.autoencoders import AutoencoderKLLTXVideo
|
| 30 |
self.base_vae = AutoencoderKLLTXVideo.from_pretrained(
|
| 31 |
"linoyts/LTX-Video-spatial-upscaler-0.9.8",
|
|
@@ -64,18 +63,18 @@ class LatentEnhancerSpecialist:
|
|
| 64 |
def refine(self, latents: torch.Tensor, fps: int = 24, **kwargs) -> torch.Tensor:
|
| 65 |
"""
|
| 66 |
Invoca o LTX Pool Manager para refinar um tensor latente existente.
|
| 67 |
-
Esta função foi movida de Deformes4DEngine para centralizar a lógica.
|
| 68 |
"""
|
| 69 |
logger.info(f"[Enhancer] Refinando tensor latente com shape {latents.shape}.")
|
| 70 |
|
| 71 |
-
# A lógica de refinamento usa o VAE principal do ltx_manager, não o do upscaler
|
| 72 |
main_pipeline_vae = ltx_manager_singleton.workers[0].pipeline.vae
|
| 73 |
video_scale_factor = getattr(main_pipeline_vae.config, 'temporal_scale_factor', 8)
|
| 74 |
|
| 75 |
-
# O ltx_manager agora lida com o dimensionamento, então não precisamos pré-calcular
|
| 76 |
-
# Apenas garantimos que o número de frames seja passado corretamente
|
| 77 |
_, _, num_latent_frames, _, _ = latents.shape
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
final_ltx_params = {
|
| 81 |
"video_total_frames": pixel_frames,
|
|
|
|
| 25 |
if self.pipe_upsample is not None:
|
| 26 |
return
|
| 27 |
try:
|
|
|
|
| 28 |
from diffusers.models.autoencoders import AutoencoderKLLTXVideo
|
| 29 |
self.base_vae = AutoencoderKLLTXVideo.from_pretrained(
|
| 30 |
"linoyts/LTX-Video-spatial-upscaler-0.9.8",
|
|
|
|
| 63 |
def refine(self, latents: torch.Tensor, fps: int = 24, **kwargs) -> torch.Tensor:
|
| 64 |
"""
|
| 65 |
Invoca o LTX Pool Manager para refinar um tensor latente existente.
|
|
|
|
| 66 |
"""
|
| 67 |
logger.info(f"[Enhancer] Refinando tensor latente com shape {latents.shape}.")
|
| 68 |
|
|
|
|
| 69 |
main_pipeline_vae = ltx_manager_singleton.workers[0].pipeline.vae
|
| 70 |
video_scale_factor = getattr(main_pipeline_vae.config, 'temporal_scale_factor', 8)
|
| 71 |
|
|
|
|
|
|
|
| 72 |
_, _, num_latent_frames, _, _ = latents.shape
|
| 73 |
+
|
| 74 |
+
# --- [CORREÇÃO FINAL E CRÍTICA] ---
|
| 75 |
+
# A pipeline de refinamento (vid2vid) espera o número de frames de pixels que CORRESPONDE
|
| 76 |
+
# ao latente existente, SEM a lógica do +1 que ela aplicará internamente.
|
| 77 |
+
pixel_frames = (num_latent_frames - 1) * video_scale_factor
|
| 78 |
|
| 79 |
final_ltx_params = {
|
| 80 |
"video_total_frames": pixel_frames,
|