Spaces:
Paused
Paused
Update api/ltx_server_refactored.py
Browse files
api/ltx_server_refactored.py
CHANGED
|
@@ -198,6 +198,7 @@ class VideoService:
|
|
| 198 |
def _prepare_conditioning_tensor(self, filepath, height, width, padding_values):
|
| 199 |
tensor = load_image_to_tensor_with_resize_and_crop(filepath, height, width)
|
| 200 |
tensor = torch.nn.functional.pad(tensor, padding_values)
|
|
|
|
| 201 |
return tensor.to(self.device, dtype=self.runtime_autocast_dtype)
|
| 202 |
|
| 203 |
|
|
@@ -232,6 +233,8 @@ class VideoService:
|
|
| 232 |
tensor = self._prepare_conditioning_tensor(media, height, width, padding_values) if isinstance(media, str) else media.to(self.device, dtype=self.runtime_autocast_dtype)
|
| 233 |
safe_frame = max(0, min(int(frame), num_frames - 1))
|
| 234 |
conditioning_items.append(ConditioningItem(tensor, safe_frame, float(weight)))
|
|
|
|
|
|
|
| 235 |
return conditioning_items
|
| 236 |
|
| 237 |
def generate_low(self, prompt, negative_prompt, height, width, duration, guidance_scale, seed, conditioning_items=None):
|
|
|
|
| 198 |
def _prepare_conditioning_tensor(self, filepath, height, width, padding_values):
|
| 199 |
tensor = load_image_to_tensor_with_resize_and_crop(filepath, height, width)
|
| 200 |
tensor = torch.nn.functional.pad(tensor, padding_values)
|
| 201 |
+
log_tensor_info(tensor, f"_prepare_conditioning_tensor")
|
| 202 |
return tensor.to(self.device, dtype=self.runtime_autocast_dtype)
|
| 203 |
|
| 204 |
|
|
|
|
| 233 |
tensor = self._prepare_conditioning_tensor(media, height, width, padding_values) if isinstance(media, str) else media.to(self.device, dtype=self.runtime_autocast_dtype)
|
| 234 |
safe_frame = max(0, min(int(frame), num_frames - 1))
|
| 235 |
conditioning_items.append(ConditioningItem(tensor, safe_frame, float(weight)))
|
| 236 |
+
|
| 237 |
+
|
| 238 |
return conditioning_items
|
| 239 |
|
| 240 |
def generate_low(self, prompt, negative_prompt, height, width, duration, guidance_scale, seed, conditioning_items=None):
|