Update deformes4D_engine.py
Browse files- deformes4D_engine.py +9 -10
deformes4D_engine.py
CHANGED
|
@@ -264,32 +264,31 @@ class Deformes4DEngine:
|
|
| 264 |
|
| 265 |
|
| 266 |
def _render_and_post_process(self, final_concatenated_latents: torch.Tensor,
|
| 267 |
-
|
| 268 |
-
"""
|
| 269 |
-
Aplica upscale + refinamento nos latentes finais e salva o vídeo em alta qualidade.
|
| 270 |
-
"""
|
| 271 |
logger.info("Iniciando pós-processamento: upscale + refinamento...")
|
| 272 |
|
| 273 |
-
# --- 1. Upscale
|
| 274 |
upscaled_latents = upscaler_specialist_singleton.upscale(final_concatenated_latents)
|
| 275 |
-
|
| 276 |
logger.info(f"Upscale concluído: shape {list(upscaled_latents.shape)}")
|
| 277 |
|
| 278 |
-
# --- 2. Refinamento
|
|
|
|
| 279 |
refined_latents, _ = ltx_manager_singleton.refine_latents(
|
| 280 |
upscaled_latents,
|
|
|
|
|
|
|
| 281 |
denoise_strength=0.4,
|
| 282 |
refine_steps=10
|
| 283 |
)
|
| 284 |
logger.info("Refinamento concluído.")
|
| 285 |
|
| 286 |
-
# --- 3. Decodificação
|
| 287 |
pixel_tensor = self.latents_to_pixels(refined_latents)
|
| 288 |
video_path = os.path.join(self.workspace_dir, f"{base_name}_HQ.mp4")
|
| 289 |
self.save_video_from_tensor(pixel_tensor, video_path, fps=fps)
|
| 290 |
-
|
| 291 |
logger.info(f"Vídeo final salvo em: {video_path}")
|
| 292 |
-
|
|
|
|
| 293 |
|
| 294 |
|
| 295 |
def _generate_latent_tensor_internal(self, conditioning_items, ltx_params, target_resolution, total_frames_to_generate):
|
|
|
|
| 264 |
|
| 265 |
|
| 266 |
def _render_and_post_process(self, final_concatenated_latents: torch.Tensor,
|
| 267 |
+
base_name: str, expected_height: int, expected_width: int, fps: int = 24) -> str:
|
|
|
|
|
|
|
|
|
|
| 268 |
logger.info("Iniciando pós-processamento: upscale + refinamento...")
|
| 269 |
|
| 270 |
+
# --- 1. Upscale ---
|
| 271 |
upscaled_latents = upscaler_specialist_singleton.upscale(final_concatenated_latents)
|
|
|
|
| 272 |
logger.info(f"Upscale concluído: shape {list(upscaled_latents.shape)}")
|
| 273 |
|
| 274 |
+
# --- 2. Refinamento ---
|
| 275 |
+
_, _, _, h, w = upscaled_latents.shape
|
| 276 |
refined_latents, _ = ltx_manager_singleton.refine_latents(
|
| 277 |
upscaled_latents,
|
| 278 |
+
height=h,
|
| 279 |
+
width=w,
|
| 280 |
denoise_strength=0.4,
|
| 281 |
refine_steps=10
|
| 282 |
)
|
| 283 |
logger.info("Refinamento concluído.")
|
| 284 |
|
| 285 |
+
# --- 3. Decodificação ---
|
| 286 |
pixel_tensor = self.latents_to_pixels(refined_latents)
|
| 287 |
video_path = os.path.join(self.workspace_dir, f"{base_name}_HQ.mp4")
|
| 288 |
self.save_video_from_tensor(pixel_tensor, video_path, fps=fps)
|
|
|
|
| 289 |
logger.info(f"Vídeo final salvo em: {video_path}")
|
| 290 |
+
return refined_latents
|
| 291 |
+
|
| 292 |
|
| 293 |
|
| 294 |
def _generate_latent_tensor_internal(self, conditioning_items, ltx_params, target_resolution, total_frames_to_generate):
|