Update api/ltx_server_refactored.py
Browse files- api/ltx_server_refactored.py +16 -0
api/ltx_server_refactored.py
CHANGED
|
@@ -238,6 +238,7 @@ class VideoService:
|
|
| 238 |
used_seed = random.randint(0, 2**32 - 1) if seed is None else int(seed)
|
| 239 |
seed_everething(used_seed)
|
| 240 |
FPS = 24.0
|
|
|
|
| 241 |
actual_num_frames = max(9, int(round((round(duration * FPS) - 1) / 8.0) * 8 + 1))
|
| 242 |
height_padded = ((height - 1) // 8 + 1) * 8
|
| 243 |
width_padded = ((width - 1) // 8 + 1) * 8
|
|
@@ -256,6 +257,8 @@ class VideoService:
|
|
| 256 |
#"guidance_scale": float(guidance_scale),
|
| 257 |
**(self.config.get("first_pass", {}))
|
| 258 |
}
|
|
|
|
|
|
|
| 259 |
try:
|
| 260 |
with torch.autocast(device_type="cuda", dtype=self.runtime_autocast_dtype, enabled=self.device == 'cuda'):
|
| 261 |
latents = self.pipeline(**first_pass_kwargs).images
|
|
@@ -336,6 +339,9 @@ class VideoService:
|
|
| 336 |
**first_pass_config
|
| 337 |
}
|
| 338 |
|
|
|
|
|
|
|
|
|
|
| 339 |
results_dir = "/app/output"; os.makedirs(results_dir, exist_ok=True)
|
| 340 |
|
| 341 |
|
|
@@ -443,6 +449,13 @@ class VideoService:
|
|
| 443 |
ltx_configs_override=ltx_configs_override
|
| 444 |
)
|
| 445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
log_tensor_info(latentes_bruto_r, f"latentes_bruto_r recebidk: {i}...'")
|
| 447 |
|
| 448 |
#latent_path_bufer = load_tensor(latent_path)
|
|
@@ -533,6 +546,9 @@ class VideoService:
|
|
| 533 |
ltx_configs_override=ltx_configs_override
|
| 534 |
)
|
| 535 |
|
|
|
|
|
|
|
|
|
|
| 536 |
final_latents = torch.load(latent_path).to(self.device)
|
| 537 |
print("\n--- Finalizando Geração Simples: Salvando e decodificando ---")
|
| 538 |
log_tensor_info(final_latents, "Tensor de Latentes Final")
|
|
|
|
| 238 |
used_seed = random.randint(0, 2**32 - 1) if seed is None else int(seed)
|
| 239 |
seed_everething(used_seed)
|
| 240 |
FPS = 24.0
|
| 241 |
+
|
| 242 |
actual_num_frames = max(9, int(round((round(duration * FPS) - 1) / 8.0) * 8 + 1))
|
| 243 |
height_padded = ((height - 1) // 8 + 1) * 8
|
| 244 |
width_padded = ((width - 1) // 8 + 1) * 8
|
|
|
|
| 257 |
#"guidance_scale": float(guidance_scale),
|
| 258 |
**(self.config.get("first_pass", {}))
|
| 259 |
}
|
| 260 |
+
|
| 261 |
+
print(f"[DEBUG] generate_low.first_pass_kwargs: {first_pass_kwargs}")
|
| 262 |
try:
|
| 263 |
with torch.autocast(device_type="cuda", dtype=self.runtime_autocast_dtype, enabled=self.device == 'cuda'):
|
| 264 |
latents = self.pipeline(**first_pass_kwargs).images
|
|
|
|
| 339 |
**first_pass_config
|
| 340 |
}
|
| 341 |
|
| 342 |
+
print(f"[DEBUG] _generate_single_chunk_low.first_pass_kwargs: {first_pass_kwargs}")
|
| 343 |
+
|
| 344 |
+
|
| 345 |
results_dir = "/app/output"; os.makedirs(results_dir, exist_ok=True)
|
| 346 |
|
| 347 |
|
|
|
|
| 449 |
ltx_configs_override=ltx_configs_override
|
| 450 |
)
|
| 451 |
|
| 452 |
+
|
| 453 |
+
print(f"[DEBUG] generate_narrative_low.frames_per_chunk: {frames_per_chunk}")
|
| 454 |
+
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
|
| 458 |
+
|
| 459 |
log_tensor_info(latentes_bruto_r, f"latentes_bruto_r recebidk: {i}...'")
|
| 460 |
|
| 461 |
#latent_path_bufer = load_tensor(latent_path)
|
|
|
|
| 546 |
ltx_configs_override=ltx_configs_override
|
| 547 |
)
|
| 548 |
|
| 549 |
+
print(f"[DEBUG] generate_single_low.total_actual_frames: {total_actual_frames}")
|
| 550 |
+
|
| 551 |
+
|
| 552 |
final_latents = torch.load(latent_path).to(self.device)
|
| 553 |
print("\n--- Finalizando Geração Simples: Salvando e decodificando ---")
|
| 554 |
log_tensor_info(final_latents, "Tensor de Latentes Final")
|