Update deformes4D_engine.py
Browse files- deformes4D_engine.py +13 -41
deformes4D_engine.py
CHANGED
|
@@ -249,53 +249,25 @@ class Deformes4DEngine:
|
|
| 249 |
|
| 250 |
|
| 251 |
# Pós-produção: Upscale + Refine
|
| 252 |
-
high_quality_video_path = self._render_and_post_process(
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
)
|
| 259 |
|
| 260 |
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
|
| 268 |
yield {"final_path": high_quality_video_path}
|
| 269 |
|
| 270 |
|
| 271 |
-
def _render_and_post_process(self, final_concatenated_latents: torch.Tensor,
|
| 272 |
-
base_name: str, expected_height: int, expected_width: int, fps: int = 24) -> str:
|
| 273 |
-
logger.info("Iniciando pós-processamento: upscale + refinamento...")
|
| 274 |
-
|
| 275 |
-
# --- 1. Upscale ---
|
| 276 |
-
upscaled_latents = upscaler_specialist_singleton.upscale(final_concatenated_latents)
|
| 277 |
-
logger.info(f"Upscale concluído: shape {list(upscaled_latents.shape)}")
|
| 278 |
-
|
| 279 |
-
# --- 2. Refinamento ---
|
| 280 |
-
_, _, _, h, w = upscaled_latents.shape
|
| 281 |
-
refined_latents, _ = ltx_manager_singleton.refine_latents(
|
| 282 |
-
upscaled_latents,
|
| 283 |
-
height=h,
|
| 284 |
-
width=w,
|
| 285 |
-
denoise_strength=0.35, # levemente menor pra preservar nitidez
|
| 286 |
-
refine_steps=12 # mais iterações pra polir detalhes
|
| 287 |
-
)
|
| 288 |
-
logger.info("Refinamento concluído.")
|
| 289 |
-
|
| 290 |
-
# --- 3. Decodificação ---
|
| 291 |
-
pixel_tensor = self.latents_to_pixels(refined_latents)
|
| 292 |
-
|
| 293 |
-
# --- 4. Render final ---
|
| 294 |
-
video_path = os.path.join(self.workspace_dir, f"{base_name}_HQ.mp4")
|
| 295 |
-
self.save_video_from_tensor(pixel_tensor, video_path, fps=fps)
|
| 296 |
-
logger.info(f"Vídeo final salvo em: {video_path}")
|
| 297 |
-
|
| 298 |
-
return video_path
|
| 299 |
|
| 300 |
|
| 301 |
|
|
|
|
| 249 |
|
| 250 |
|
| 251 |
# Pós-produção: Upscale + Refine
|
| 252 |
+
#high_quality_video_path = self._render_and_post_process(
|
| 253 |
+
# final_concatenated_latents,
|
| 254 |
+
# base_name=base_name,
|
| 255 |
+
# expected_height=720,
|
| 256 |
+
# expected_width=720,
|
| 257 |
+
# fps=24
|
| 258 |
+
#)
|
| 259 |
|
| 260 |
|
| 261 |
+
progress((num_transitions_to_generate + 1.5) / (num_transitions_to_generate + 2), desc="Gerando paisagem sonora...")
|
| 262 |
+
video_with_audio_path = self._generate_video_and_audio(
|
| 263 |
+
silent_video_path=silent_video_path,
|
| 264 |
+
audio_prompt=global_prompt,
|
| 265 |
+
base_name=base_name
|
| 266 |
+
)
|
| 267 |
|
| 268 |
yield {"final_path": high_quality_video_path}
|
| 269 |
|
| 270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
|
| 272 |
|
| 273 |
|