Update ltx_manager_helpers.py
Browse files- ltx_manager_helpers.py +11 -5
ltx_manager_helpers.py
CHANGED
|
@@ -18,7 +18,7 @@ import json
|
|
| 18 |
from optimization import optimize_ltx_worker, can_optimize_fp8
|
| 19 |
from hardware_manager import hardware_manager
|
| 20 |
from inference import create_ltx_video_pipeline, calculate_padding
|
| 21 |
-
from ltx_video.pipelines.pipeline_ltx_video import LatentConditioningItem
|
| 22 |
|
| 23 |
logger = logging.getLogger(__name__)
|
| 24 |
|
|
@@ -111,14 +111,11 @@ class LtxPoolManager:
|
|
| 111 |
padded_h, padded_w = ((height - 1) // 32 + 1) * 32, ((width - 1) // 32 + 1) * 32
|
| 112 |
padding_vals = calculate_padding(height, width, padded_h, padded_w)
|
| 113 |
|
| 114 |
-
# --- [IN脥CIO DA CORRE脟脙O] ---
|
| 115 |
-
# Move o tensor DENTRO de cada item de condicionamento para o dispositivo do worker.
|
| 116 |
conditioning_data = kwargs.get('conditioning_items_data', [])
|
| 117 |
final_conditioning_items = []
|
| 118 |
for item in conditioning_data:
|
| 119 |
item.latent_tensor = item.latent_tensor.to(worker_to_use.device)
|
| 120 |
final_conditioning_items.append(item)
|
| 121 |
-
# --- [FIM DA CORRE脟脙O] ---
|
| 122 |
|
| 123 |
pipeline_params = {
|
| 124 |
"height": padded_h, "width": padded_w, "num_frames": kwargs['video_total_frames'],
|
|
@@ -160,7 +157,16 @@ class LtxPoolManager:
|
|
| 160 |
}
|
| 161 |
|
| 162 |
logger.info("LTX POOL MANAGER: Iniciando passe de refinamento (denoise)...")
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
return result, None
|
| 165 |
except Exception as e:
|
| 166 |
logger.error(f"LTX POOL MANAGER: Erro durante o refinamento em {worker_to_use.device}: {e}", exc_info=True)
|
|
|
|
| 18 |
from optimization import optimize_ltx_worker, can_optimize_fp8
|
| 19 |
from hardware_manager import hardware_manager
|
| 20 |
from inference import create_ltx_video_pipeline, calculate_padding
|
| 21 |
+
from ltx_video.pipelines.pipeline_ltx_video import LatentConditioningItem, LTXMultiScalePipeline
|
| 22 |
|
| 23 |
logger = logging.getLogger(__name__)
|
| 24 |
|
|
|
|
| 111 |
padded_h, padded_w = ((height - 1) // 32 + 1) * 32, ((width - 1) // 32 + 1) * 32
|
| 112 |
padding_vals = calculate_padding(height, width, padded_h, padded_w)
|
| 113 |
|
|
|
|
|
|
|
| 114 |
conditioning_data = kwargs.get('conditioning_items_data', [])
|
| 115 |
final_conditioning_items = []
|
| 116 |
for item in conditioning_data:
|
| 117 |
item.latent_tensor = item.latent_tensor.to(worker_to_use.device)
|
| 118 |
final_conditioning_items.append(item)
|
|
|
|
| 119 |
|
| 120 |
pipeline_params = {
|
| 121 |
"height": padded_h, "width": padded_w, "num_frames": kwargs['video_total_frames'],
|
|
|
|
| 157 |
}
|
| 158 |
|
| 159 |
logger.info("LTX POOL MANAGER: Iniciando passe de refinamento (denoise)...")
|
| 160 |
+
|
| 161 |
+
# --- [IN脥CIO DA CORRE脟脙O] ---
|
| 162 |
+
# Para o refinamento, usamos a pipeline de v铆deo base diretamente,
|
| 163 |
+
# ignorando o inv贸lucro MultiScale que causa o erro de processamento de imagem.
|
| 164 |
+
if isinstance(worker_to_use.pipeline, LTXMultiScalePipeline):
|
| 165 |
+
result = worker_to_use.pipeline.video_pipeline(**pipeline_params).images
|
| 166 |
+
else:
|
| 167 |
+
result = worker_to_use.generate_video_fragment_internal(**pipeline_params)
|
| 168 |
+
# --- [FIM DA CORRE脟脙O] ---
|
| 169 |
+
|
| 170 |
return result, None
|
| 171 |
except Exception as e:
|
| 172 |
logger.error(f"LTX POOL MANAGER: Erro durante o refinamento em {worker_to_use.device}: {e}", exc_info=True)
|