Update api/ltx_server_refactored.py
Browse files
api/ltx_server_refactored.py
CHANGED
|
@@ -513,6 +513,12 @@ class VideoService:
|
|
| 513 |
conditioning_items = []
|
| 514 |
for filepath in image_filepaths:
|
| 515 |
cond_tensor = self._prepare_conditioning_tensor(filepath, downscaled_height, downscaled_width, padding_values)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 516 |
conditioning_items.append(ConditioningItem(cond_tensor, 0, 1.0))
|
| 517 |
|
| 518 |
|
|
@@ -678,6 +684,7 @@ class VideoService:
|
|
| 678 |
return video_path_out, latents_path_out
|
| 679 |
|
| 680 |
|
|
|
|
| 681 |
|
| 682 |
def encode_latents_to_mp4(self, latents_path: str, fps: int = int(DEFAULT_FPS)) -> str:
|
| 683 |
"""Decodifica um tensor de latentes salvo e o salva como um vídeo MP4."""
|
|
|
|
| 513 |
conditioning_items = []
|
| 514 |
for filepath in image_filepaths:
|
| 515 |
cond_tensor = self._prepare_conditioning_tensor(filepath, downscaled_height, downscaled_width, padding_values)
|
| 516 |
+
media_item_latents = vae_encode(
|
| 517 |
+
media_item.to(dtype=self.vae.dtype, device=self.vae.device),
|
| 518 |
+
self.vae,
|
| 519 |
+
vae_per_channel_normalize=vae_per_channel_normalize,
|
| 520 |
+
).to(dtype=init_latents.dtype)
|
| 521 |
+
|
| 522 |
conditioning_items.append(ConditioningItem(cond_tensor, 0, 1.0))
|
| 523 |
|
| 524 |
|
|
|
|
| 684 |
return video_path_out, latents_path_out
|
| 685 |
|
| 686 |
|
| 687 |
+
|
| 688 |
|
| 689 |
def encode_latents_to_mp4(self, latents_path: str, fps: int = int(DEFAULT_FPS)) -> str:
|
| 690 |
"""Decodifica um tensor de latentes salvo e o salva como um vídeo MP4."""
|