Eueuiaa commited on
Commit
f7c3f47
·
verified ·
1 Parent(s): cc030e3

Update api/ltx_server.py

Browse files
Files changed (1) hide show
  1. api/ltx_server.py +20 -10
api/ltx_server.py CHANGED
@@ -571,7 +571,7 @@ class VideoService:
571
 
572
  n_chunks = (sum_latent) // num_latente_por_chunk
573
  steps = sum_latent//n_chunks
574
- print("================PODA CAUSAL=================")
575
  print(f"[DEBUG] TOTAL LATENTES = {sum_latent}")
576
  print(f"[DEBUG] LATENTES min por chunk = {num_latente_por_chunk}")
577
  print(f"[DEBUG] Número de chunks = {n_chunks}")
@@ -581,18 +581,22 @@ class VideoService:
581
  start = (num_latente_por_chunk*i)
582
  end = (start+num_latente_por_chunk+overlap)
583
  if i+1 < n_chunks:
584
- chunk = latents_brutos[:, :, start:end, :, :].clone().detach()
585
- print(f"[DEBUG] chunk{i+1}[:, :, {start}:{end}, :, :] = {chunk.shape[2]}")
 
 
 
 
586
  else:
587
- chunk = latents_brutos[:, :, start:, :, :].clone().detach()
588
- print(f"[DEBUG] chunk{i+1}[:, :, {start}:, :, :] = {chunk.shape[2]}")
589
  chunks.append(chunk)
590
  i+=1
591
  else:
592
  print(f"[DEBUG] numero chunks minimo ")
593
  print(f"[DEBUG] latents_brutos[:, :, :, :, :] = {latents_brutos.shape[2]}")
594
  chunks.append(latents_brutos)
595
- print("================PODA CAUSAL=================")
596
  return chunks
597
 
598
  def _get_total_frames(self, video_path: str) -> int:
@@ -621,10 +625,16 @@ class VideoService:
621
  video_fade_ini = None
622
  nova_lista = []
623
 
624
- print("===========CONCATECAO CAUSAL=============")
 
 
 
 
 
625
 
626
  print(f"[DEBUG] Iniciando pipeline com {total_partes} vídeos e {poda} frames de crossfade")
627
-
 
628
  for i in range(total_partes):
629
  base = video_paths[i]
630
 
@@ -683,7 +693,7 @@ class VideoService:
683
 
684
  nova_lista.append(video_podado)
685
  print(f"[DEBUG] Video podado {i+1} adicionado {self._get_total_frames(video_podado)} frames ✅")
686
-
687
 
688
 
689
  print("===========CONCATECAO CAUSAL=============")
@@ -947,7 +957,7 @@ class VideoService:
947
  except Exception:
948
  pass
949
 
950
- latents_parts_vae = self._dividir_latentes_por_tamanho(latents_cpu_vae,15,1)
951
 
952
  for latents in latents_parts_vae:
953
  print(f"[DEBUG] Partição {par}: {tuple(latents.shape)}")
 
571
 
572
  n_chunks = (sum_latent) // num_latente_por_chunk
573
  steps = sum_latent//n_chunks
574
+ print("==========PODA CAUSAL[start:stop-1]==========")
575
  print(f"[DEBUG] TOTAL LATENTES = {sum_latent}")
576
  print(f"[DEBUG] LATENTES min por chunk = {num_latente_por_chunk}")
577
  print(f"[DEBUG] Número de chunks = {n_chunks}")
 
581
  start = (num_latente_por_chunk*i)
582
  end = (start+num_latente_por_chunk+overlap)
583
  if i+1 < n_chunks:
584
+ if i > 0:
585
+ chunk = latents_brutos[:, :, start-overlap:end, :, :].clone().detach()
586
+ print(f"[DEBUG] chunk{i+1}[:, :, {start}:{end}, :, :] = {chunk.shape[2]}")
587
+ else:
588
+ chunk = latents_brutos[:, :, start:end, :, :].clone().detach()
589
+ print(f"[DEBUG] chunk{i+1}[:, :, {start}:{end}, :, :] = {chunk.shape[2]}")
590
  else:
591
+ chunk = latents_brutos[:, :, start-overlap:, :, :].clone().detach()
592
+ print(f"[DEBUG] chunk{i+1}[:, :, {start-overlap}:, :, :] = {chunk.shape[2]}")
593
  chunks.append(chunk)
594
  i+=1
595
  else:
596
  print(f"[DEBUG] numero chunks minimo ")
597
  print(f"[DEBUG] latents_brutos[:, :, :, :, :] = {latents_brutos.shape[2]}")
598
  chunks.append(latents_brutos)
599
+ print("\n\n================PODA CAUSAL=================")
600
  return chunks
601
 
602
  def _get_total_frames(self, video_path: str) -> int:
 
625
  video_fade_ini = None
626
  nova_lista = []
627
 
628
+ if crossfade_frames == 0:
629
+ print("\n\n[DEBUG] CROSSFADE_FRAMES=0 Ship concatenation causal")
630
+ return video_paths
631
+
632
+
633
+ print("\n\n===========CONCATECAO CAUSAL=============")
634
 
635
  print(f"[DEBUG] Iniciando pipeline com {total_partes} vídeos e {poda} frames de crossfade")
636
+
637
+
638
  for i in range(total_partes):
639
  base = video_paths[i]
640
 
 
693
 
694
  nova_lista.append(video_podado)
695
  print(f"[DEBUG] Video podado {i+1} adicionado {self._get_total_frames(video_podado)} frames ✅")
696
+
697
 
698
 
699
  print("===========CONCATECAO CAUSAL=============")
 
957
  except Exception:
958
  pass
959
 
960
+ latents_parts_vae = self._dividir_latentes_por_tamanho(latents_cpu_vae,4,1)
961
 
962
  for latents in latents_parts_vae:
963
  print(f"[DEBUG] Partição {par}: {tuple(latents.shape)}")