Update api/ltx_server_refactored.py
Browse files- api/ltx_server_refactored.py +7 -16
api/ltx_server_refactored.py
CHANGED
|
@@ -393,7 +393,7 @@ class VideoService:
|
|
| 393 |
def generate_narrative_low(
|
| 394 |
self, prompt: str, negative_prompt,
|
| 395 |
height, width, duration, guidance_scale,
|
| 396 |
-
seed, initial_conditions, overlap_frames: int =
|
| 397 |
ltx_configs_override: dict = None):
|
| 398 |
"""
|
| 399 |
[ORQUESTRADOR NARRATIVO]
|
|
@@ -412,23 +412,14 @@ class VideoService:
|
|
| 412 |
num_chunks = len(prompt_list)
|
| 413 |
if num_chunks == 0: raise ValueError("O prompt está vazio ou não contém linhas válidas.")
|
| 414 |
|
| 415 |
-
total_actual_frames = max(
|
| 416 |
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
blocks_last_chunk = total_blocks - (blocks_per_chunk * (num_chunks - 1))
|
| 421 |
-
frames_per_chunk = blocks_per_chunk * 8 + 1
|
| 422 |
-
frames_per_chunk_last = blocks_last_chunk * 8 + 1
|
| 423 |
-
else:
|
| 424 |
-
frames_per_chunk = total_actual_frames
|
| 425 |
-
frames_per_chunk_last = total_actual_frames
|
| 426 |
|
| 427 |
-
|
| 428 |
-
frames_per_chunk_last = max(9, frames_per_chunk_last)
|
| 429 |
|
| 430 |
-
poda_latents_num = overlap_frames // self.pipeline.video_scale_factor if self.pipeline.video_scale_factor > 0 else 0
|
| 431 |
-
|
| 432 |
|
| 433 |
latentes_chunk_video = []
|
| 434 |
overlap_condition = []
|
|
@@ -463,7 +454,7 @@ class VideoService:
|
|
| 463 |
if i == num_chunks - 1:
|
| 464 |
frames_per_chunk = frames_per_chunk_last+poda_latents_num
|
| 465 |
|
| 466 |
-
frames_per_chunk = ((frames_per_chunk - 1)//8)*8 + 1
|
| 467 |
|
| 468 |
|
| 469 |
if i> 0:
|
|
|
|
| 393 |
def generate_narrative_low(
|
| 394 |
self, prompt: str, negative_prompt,
|
| 395 |
height, width, duration, guidance_scale,
|
| 396 |
+
seed, initial_conditions, overlap_frames: int = 4,
|
| 397 |
ltx_configs_override: dict = None):
|
| 398 |
"""
|
| 399 |
[ORQUESTRADOR NARRATIVO]
|
|
|
|
| 412 |
num_chunks = len(prompt_list)
|
| 413 |
if num_chunks == 0: raise ValueError("O prompt está vazio ou não contém linhas válidas.")
|
| 414 |
|
| 415 |
+
total_actual_frames = max(8, int(round((round(duration * FPS) ) / 8.0) * 8 ))
|
| 416 |
|
| 417 |
+
|
| 418 |
+
frames_per_chunk = total_actual_frames//num_chunks
|
| 419 |
+
#frames_per_chunk_last = max(9, frames_per_chunk_last)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
+
poda_latents_num = overlap_frames
|
|
|
|
| 422 |
|
|
|
|
|
|
|
| 423 |
|
| 424 |
latentes_chunk_video = []
|
| 425 |
overlap_condition = []
|
|
|
|
| 454 |
if i == num_chunks - 1:
|
| 455 |
frames_per_chunk = frames_per_chunk_last+poda_latents_num
|
| 456 |
|
| 457 |
+
#frames_per_chunk = ((frames_per_chunk - 1)//8)*8 + 1
|
| 458 |
|
| 459 |
|
| 460 |
if i> 0:
|