Spaces:
Paused
Paused
Update api/ltx_server_refactored.py
Browse files- api/ltx_server_refactored.py +11 -4
api/ltx_server_refactored.py
CHANGED
|
@@ -213,12 +213,16 @@ class VideoService:
|
|
| 213 |
return final_path
|
| 214 |
|
| 215 |
def _load_tensor(self, caminho):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
if isinstance(caminho, (bytes, bytearray)):
|
| 217 |
return torch.load(io.BytesIO(caminho))
|
|
|
|
| 218 |
return torch.load(caminho)
|
| 219 |
|
| 220 |
|
| 221 |
-
|
| 222 |
# ==============================================================================
|
| 223 |
# --- FUNÇÕES MODULARES COM A LÓGICA DE CHUNKING SIMPLIFICADA ---
|
| 224 |
# ==============================================================================
|
|
@@ -457,11 +461,14 @@ class VideoService:
|
|
| 457 |
if i> 0:
|
| 458 |
initial_conditions = []
|
| 459 |
|
| 460 |
-
if
|
| 461 |
-
|
|
|
|
|
|
|
|
|
|
| 462 |
items_list = [[overlap_latents_r, 0, 1.0]]
|
| 463 |
overlap_condition = self._prepare_condition_items_latent(items_list)
|
| 464 |
-
|
| 465 |
itens_conditions_itens = initial_conditions + overlap_condition
|
| 466 |
|
| 467 |
latentes_bruto_r = self._generate_single_chunk_low(
|
|
|
|
| 213 |
return final_path
|
| 214 |
|
| 215 |
def _load_tensor(self, caminho):
|
| 216 |
+
# Se já é um tensor, retorna diretamente
|
| 217 |
+
if isinstance(caminho, torch.Tensor):
|
| 218 |
+
return caminho
|
| 219 |
+
# Se é bytes, carrega do buffer
|
| 220 |
if isinstance(caminho, (bytes, bytearray)):
|
| 221 |
return torch.load(io.BytesIO(caminho))
|
| 222 |
+
# Caso contrário, assume que é um caminho de arquivo
|
| 223 |
return torch.load(caminho)
|
| 224 |
|
| 225 |
|
|
|
|
| 226 |
# ==============================================================================
|
| 227 |
# --- FUNÇÕES MODULARES COM A LÓGICA DE CHUNKING SIMPLIFICADA ---
|
| 228 |
# ==============================================================================
|
|
|
|
| 461 |
if i> 0:
|
| 462 |
initial_conditions = []
|
| 463 |
|
| 464 |
+
if i > 0:
|
| 465 |
+
initial_conditions = []
|
| 466 |
+
if overlap_latents is not None:
|
| 467 |
+
# Já é um tensor, usa diretamente
|
| 468 |
+
overlap_latents_r = overlap_latents
|
| 469 |
items_list = [[overlap_latents_r, 0, 1.0]]
|
| 470 |
overlap_condition = self._prepare_condition_items_latent(items_list)
|
| 471 |
+
|
| 472 |
itens_conditions_itens = initial_conditions + overlap_condition
|
| 473 |
|
| 474 |
latentes_bruto_r = self._generate_single_chunk_low(
|