Update api/ltx_server.py
Browse files- api/ltx_server.py +9 -13
api/ltx_server.py
CHANGED
|
@@ -632,21 +632,15 @@ class VideoService:
|
|
| 632 |
t_sp = time.perf_counter()
|
| 633 |
ctx = torch.autocast(device_type="cuda", dtype=self.runtime_autocast_dtype) if self.device == "cuda" else contextlib.nullcontext()
|
| 634 |
with ctx:
|
| 635 |
-
|
| 636 |
print(f"[DEBUG] single-pass tempo={time.perf_counter()-t_sp:.3f}s")
|
| 637 |
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
elif hasattr(result, "images") and isinstance(result.images, torch.Tensor):
|
| 641 |
-
latents = result.images
|
| 642 |
-
else:
|
| 643 |
-
latents = result
|
| 644 |
-
#print(f"[DEBUG] Latentes (first_pass_kwargs): shape={tuple(latents.shape)}")
|
| 645 |
|
| 646 |
-
|
| 647 |
-
print(f"[DEBUG] Passo 1 conclu铆do. Shape dos latentes de baixa resolu莽茫o: {latents_low_res.shape}")
|
| 648 |
|
| 649 |
-
del
|
| 650 |
gc.collect()
|
| 651 |
if self.device == "cuda": torch.cuda.empty_cache()
|
| 652 |
|
|
@@ -654,10 +648,12 @@ class VideoService:
|
|
| 654 |
print("[DEBUG] Multi-escala: Fazendo upscale dos latentes com latent_upsampler.")
|
| 655 |
with ctx:
|
| 656 |
latents_high_res = self.latent_upsampler(
|
| 657 |
-
latents=
|
| 658 |
output_height=original_height,
|
| 659 |
output_width=original_width,
|
| 660 |
-
|
|
|
|
|
|
|
| 661 |
log_tensor_info(latents_high_res, "Latentes (P贸s-Upscale)")
|
| 662 |
del latents_low_res
|
| 663 |
gc.collect()
|
|
|
|
| 632 |
t_sp = time.perf_counter()
|
| 633 |
ctx = torch.autocast(device_type="cuda", dtype=self.runtime_autocast_dtype) if self.device == "cuda" else contextlib.nullcontext()
|
| 634 |
with ctx:
|
| 635 |
+
latents = self.pipeline(**single_pass_kwargs).frames
|
| 636 |
print(f"[DEBUG] single-pass tempo={time.perf_counter()-t_sp:.3f}s")
|
| 637 |
|
| 638 |
+
|
| 639 |
+
print(f"[DEBUG] Latentes (first_pass_kwargs): shape={tuple(latents.shape)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
|
| 641 |
+
|
|
|
|
| 642 |
|
| 643 |
+
del single_pass_kwargs
|
| 644 |
gc.collect()
|
| 645 |
if self.device == "cuda": torch.cuda.empty_cache()
|
| 646 |
|
|
|
|
| 648 |
print("[DEBUG] Multi-escala: Fazendo upscale dos latentes com latent_upsampler.")
|
| 649 |
with ctx:
|
| 650 |
latents_high_res = self.latent_upsampler(
|
| 651 |
+
latents=latents,
|
| 652 |
output_height=original_height,
|
| 653 |
output_width=original_width,
|
| 654 |
+
output_type="latent"
|
| 655 |
+
).frames
|
| 656 |
+
|
| 657 |
log_tensor_info(latents_high_res, "Latentes (P贸s-Upscale)")
|
| 658 |
del latents_low_res
|
| 659 |
gc.collect()
|