Update video_service.py
Browse files- video_service.py +11 -6
video_service.py
CHANGED
|
@@ -485,7 +485,7 @@ class VideoService:
|
|
| 485 |
with ctx:
|
| 486 |
result_tensor = multi_scale_pipeline(**multi_scale_call_kwargs).images
|
| 487 |
log_tensor_info(result_tensor, "Resultado da Etapa 2 (Saída do Pipeline Multi-Scale)")
|
| 488 |
-
|
| 489 |
single_pass_kwargs = call_kwargs.copy()
|
| 490 |
first_pass_config = self.config.get("first_pass", {})
|
| 491 |
single_pass_kwargs.update(
|
|
@@ -496,19 +496,24 @@ class VideoService:
|
|
| 496 |
"skip_block_list": first_pass_config.get("skip_block_list"),
|
| 497 |
}
|
| 498 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 499 |
if mode == "video-to-video":
|
| 500 |
single_pass_kwargs["timesteps"] = [0.7]
|
| 501 |
print("[INFO] Modo video-to-video (etapa única): definindo timesteps (força) para [0.7]")
|
| 502 |
-
|
| 503 |
-
single_pass_kwargs["timesteps"] =
|
| 504 |
-
|
|
|
|
| 505 |
print("\n[INFO] Executando pipeline de etapa única...")
|
| 506 |
ctx = contextlib.nullcontext()
|
| 507 |
if self.device == "cuda":
|
| 508 |
ctx = torch.autocast(device_type="cuda", dtype=self.runtime_autocast_dtype)
|
| 509 |
with ctx:
|
| 510 |
result_tensor = self.pipeline(**single_pass_kwargs).images
|
| 511 |
-
|
| 512 |
pad_left, pad_right, pad_top, pad_bottom = padding_values
|
| 513 |
slice_h_end = -pad_bottom if pad_bottom > 0 else None
|
| 514 |
slice_w_end = -pad_right if pad_right > 0 else None
|
|
@@ -520,7 +525,7 @@ class VideoService:
|
|
| 520 |
# Staging seguro em tmp e move para diretório persistente
|
| 521 |
temp_dir = tempfile.mkdtemp(prefix="ltxv_")
|
| 522 |
self._register_tmp_dir(temp_dir)
|
| 523 |
-
results_dir = "/
|
| 524 |
os.makedirs(results_dir, exist_ok=True)
|
| 525 |
|
| 526 |
final_output_path = None
|
|
|
|
| 485 |
with ctx:
|
| 486 |
result_tensor = multi_scale_pipeline(**multi_scale_call_kwargs).images
|
| 487 |
log_tensor_info(result_tensor, "Resultado da Etapa 2 (Saída do Pipeline Multi-Scale)")
|
| 488 |
+
else:
|
| 489 |
single_pass_kwargs = call_kwargs.copy()
|
| 490 |
first_pass_config = self.config.get("first_pass", {})
|
| 491 |
single_pass_kwargs.update(
|
|
|
|
| 496 |
"skip_block_list": first_pass_config.get("skip_block_list"),
|
| 497 |
}
|
| 498 |
)
|
| 499 |
+
|
| 500 |
+
# EVITAR guidance_timesteps no single-pass para não acionar guidance_mapping na lib
|
| 501 |
+
# Preferir 'timesteps' se existir; caso contrário, deixar sem e usar defaults do pipeline.
|
| 502 |
+
config_timesteps = first_pass_config.get("timesteps")
|
| 503 |
if mode == "video-to-video":
|
| 504 |
single_pass_kwargs["timesteps"] = [0.7]
|
| 505 |
print("[INFO] Modo video-to-video (etapa única): definindo timesteps (força) para [0.7]")
|
| 506 |
+
elif isinstance(config_timesteps, (list, tuple)) and len(config_timesteps) > 0:
|
| 507 |
+
single_pass_kwargs["timesteps"] = config_timesteps
|
| 508 |
+
# IMPORTANTE: não usar first_pass_config.get("guidance_timesteps") aqui
|
| 509 |
+
|
| 510 |
print("\n[INFO] Executando pipeline de etapa única...")
|
| 511 |
ctx = contextlib.nullcontext()
|
| 512 |
if self.device == "cuda":
|
| 513 |
ctx = torch.autocast(device_type="cuda", dtype=self.runtime_autocast_dtype)
|
| 514 |
with ctx:
|
| 515 |
result_tensor = self.pipeline(**single_pass_kwargs).images
|
| 516 |
+
|
| 517 |
pad_left, pad_right, pad_top, pad_bottom = padding_values
|
| 518 |
slice_h_end = -pad_bottom if pad_bottom > 0 else None
|
| 519 |
slice_w_end = -pad_right if pad_right > 0 else None
|
|
|
|
| 525 |
# Staging seguro em tmp e move para diretório persistente
|
| 526 |
temp_dir = tempfile.mkdtemp(prefix="ltxv_")
|
| 527 |
self._register_tmp_dir(temp_dir)
|
| 528 |
+
results_dir = "/app/output"
|
| 529 |
os.makedirs(results_dir, exist_ok=True)
|
| 530 |
|
| 531 |
final_output_path = None
|