Update api/ltx_server_refactored.py
Browse files
api/ltx_server_refactored.py
CHANGED
|
@@ -344,7 +344,7 @@ class VideoService:
|
|
| 344 |
first_pass_kwargs = {
|
| 345 |
"prompt": prompt, "negative_prompt": negative_prompt, "height": downscaled_height, "width": downscaled_width,
|
| 346 |
"num_frames": num_frames, "frame_rate": 24, "generator": generator, "output_type": "latent",
|
| 347 |
-
"
|
| 348 |
**first_pass_config,
|
| 349 |
}
|
| 350 |
|
|
@@ -381,7 +381,7 @@ class VideoService:
|
|
| 381 |
def generate_narrative_low(
|
| 382 |
self, prompt: str, negative_prompt,
|
| 383 |
height, width, duration, guidance_scale,
|
| 384 |
-
seed, initial_conditions
|
| 385 |
ltx_configs_override: dict = None):
|
| 386 |
"""
|
| 387 |
[ORQUESTRADOR NARRATIVO]
|
|
@@ -417,9 +417,10 @@ class VideoService:
|
|
| 417 |
|
| 418 |
poda_latents_num = overlap_frames // self.pipeline.video_scale_factor if self.pipeline.video_scale_factor > 0 else 0
|
| 419 |
|
| 420 |
-
|
| 421 |
latentes_chunk_video = []
|
| 422 |
overlap_condition = []
|
|
|
|
| 423 |
lista_patch_latentes_chunk = []
|
| 424 |
condition_item_latent_overlap = None
|
| 425 |
temp_dir = tempfile.mkdtemp(prefix="ltxv_narrative_"); self._register_tmp_dir(temp_dir)
|
|
@@ -453,16 +454,14 @@ class VideoService:
|
|
| 453 |
frames_per_chunk = ((frames_per_chunk - 1)//8)*8 + 1
|
| 454 |
|
| 455 |
|
| 456 |
-
if i
|
| 457 |
-
|
| 458 |
-
else:
|
| 459 |
-
initial_conditions = None
|
| 460 |
|
| 461 |
if overlap_latents!=None:
|
| 462 |
items_list = [[overlap_latents, 0, 1.0]]
|
| 463 |
overlap_condition = prepare_condition_items_latent(items_list)
|
| 464 |
|
| 465 |
-
itens_conditions_itens =
|
| 466 |
|
| 467 |
latentes_bruto_r = self._generate_single_chunk_low(
|
| 468 |
prompt=chunk_prompt, negative_prompt=negative_prompt, height=height, width=width,
|
|
|
|
| 344 |
first_pass_kwargs = {
|
| 345 |
"prompt": prompt, "negative_prompt": negative_prompt, "height": downscaled_height, "width": downscaled_width,
|
| 346 |
"num_frames": num_frames, "frame_rate": 24, "generator": generator, "output_type": "latent",
|
| 347 |
+
"conditioning_items": itens_conditions_itens,
|
| 348 |
**first_pass_config,
|
| 349 |
}
|
| 350 |
|
|
|
|
| 381 |
def generate_narrative_low(
|
| 382 |
self, prompt: str, negative_prompt,
|
| 383 |
height, width, duration, guidance_scale,
|
| 384 |
+
seed, initial_conditions, overlap_frames: int = 8,
|
| 385 |
ltx_configs_override: dict = None):
|
| 386 |
"""
|
| 387 |
[ORQUESTRADOR NARRATIVO]
|
|
|
|
| 417 |
|
| 418 |
poda_latents_num = overlap_frames // self.pipeline.video_scale_factor if self.pipeline.video_scale_factor > 0 else 0
|
| 419 |
|
| 420 |
+
|
| 421 |
latentes_chunk_video = []
|
| 422 |
overlap_condition = []
|
| 423 |
+
overlap_latents = None
|
| 424 |
lista_patch_latentes_chunk = []
|
| 425 |
condition_item_latent_overlap = None
|
| 426 |
temp_dir = tempfile.mkdtemp(prefix="ltxv_narrative_"); self._register_tmp_dir(temp_dir)
|
|
|
|
| 454 |
frames_per_chunk = ((frames_per_chunk - 1)//8)*8 + 1
|
| 455 |
|
| 456 |
|
| 457 |
+
if i> 0:
|
| 458 |
+
initial_conditions = []
|
|
|
|
|
|
|
| 459 |
|
| 460 |
if overlap_latents!=None:
|
| 461 |
items_list = [[overlap_latents, 0, 1.0]]
|
| 462 |
overlap_condition = prepare_condition_items_latent(items_list)
|
| 463 |
|
| 464 |
+
itens_conditions_itens = initial_conditions + overlap_condition
|
| 465 |
|
| 466 |
latentes_bruto_r = self._generate_single_chunk_low(
|
| 467 |
prompt=chunk_prompt, negative_prompt=negative_prompt, height=height, width=width,
|