EuuIia commited on
Commit
cca4e84
·
verified ·
1 Parent(s): bb04f38

Update api/ltx_server.py

Browse files
Files changed (1) hide show
  1. api/ltx_server.py +11 -9
api/ltx_server.py CHANGED
@@ -421,18 +421,18 @@ class VideoService:
421
  print("================PODA CAUSAL=================")
422
  print(f"[DEBUG] TOTAL LATENTES = {sum_latent}")
423
  print(f"[DEBUG] Num LATENTES por chunk = {num_latente_por_chunk}")
424
- print(f"[DEBUG] Número de chunks = {steps}")
425
 
426
 
427
- if steps > 1:
428
  i = 0
429
  end=1
430
- while i < steps:
431
  start = end-1
432
  end += num_latente_por_chunk
433
  if end+2>=sum_latent:
434
  end = sum_latent-1
435
- i = steps
436
  else:
437
  i += 1
438
  chunk = latents_brutos[:, :, start:end, :, :].clone()
@@ -752,7 +752,7 @@ class VideoService:
752
  except Exception:
753
  pass
754
 
755
- latents_parts = self._dividir_latentes_por_tamanho(latents_cpu,5,1)
756
 
757
  temp_dir = tempfile.mkdtemp(prefix="ltxv_"); self._register_tmp_dir(temp_dir)
758
  results_dir = "/app/output"; os.makedirs(results_dir, exist_ok=True)
@@ -794,10 +794,12 @@ class VideoService:
794
  final_output_path = output_video_path
795
  print(f"[DEBUG] Falha no move; usando tmp como final: {e}")
796
 
797
- final_concat = os.path.join(results_dir, f"concat_fim_{used_seed}.mp4")
798
- partes_mp4_fade = self._gerar_lista_com_transicoes(pasta=results_dir, video_paths=partes_mp4, crossfade_frames=8)
799
- self._concat_mp4s_no_reencode(partes_mp4_fade, final_concat)
800
-
 
 
801
 
802
 
803
  self._log_gpu_memory("Fim da Geração")
 
421
  print("================PODA CAUSAL=================")
422
  print(f"[DEBUG] TOTAL LATENTES = {sum_latent}")
423
  print(f"[DEBUG] Num LATENTES por chunk = {num_latente_por_chunk}")
424
+ print(f"[DEBUG] Número de chunks = {n_chunks}")
425
 
426
 
427
+ if n_chunks > 1:
428
  i = 0
429
  end=1
430
+ while i < n_chunks:
431
  start = end-1
432
  end += num_latente_por_chunk
433
  if end+2>=sum_latent:
434
  end = sum_latent-1
435
+ i = n_chunks
436
  else:
437
  i += 1
438
  chunk = latents_brutos[:, :, start:end, :, :].clone()
 
752
  except Exception:
753
  pass
754
 
755
+ latents_parts = self._dividir_latentes_por_tamanho(latents_cpu,4,1)
756
 
757
  temp_dir = tempfile.mkdtemp(prefix="ltxv_"); self._register_tmp_dir(temp_dir)
758
  results_dir = "/app/output"; os.makedirs(results_dir, exist_ok=True)
 
794
  final_output_path = output_video_path
795
  print(f"[DEBUG] Falha no move; usando tmp como final: {e}")
796
 
797
+ if (range(partes_mp4)>1)
798
+ final_vid = os.path.join(results_dir, f"concat_fim_{used_seed}.mp4")
799
+ partes_mp4_fade = self._gerar_lista_com_transicoes(pasta=results_dir, video_paths=partes_mp4, crossfade_frames=8)
800
+ self._concat_mp4s_no_reencode(partes_mp4_fade, final_vid)
801
+ else
802
+ final_vid = partes_mp4[0]
803
 
804
 
805
  self._log_gpu_memory("Fim da Geração")