Eueuiaa commited on
Commit
305c942
·
verified ·
1 Parent(s): b0109f6

Update api/ltx_server.py

Browse files
Files changed (1) hide show
  1. api/ltx_server.py +9 -8
api/ltx_server.py CHANGED
@@ -669,8 +669,8 @@ class VideoService:
669
  #if total % 2 == 1: # ÍMPAR
670
  # Ex: 11 → primeira 0..5, segunda 5..10
671
  cut = total // 2
672
- primeira = latents_brutos[:, :, :cut+1, :, :].clone()
673
- segunda = latents_brutos[:, :, cut:, :, :].clone()
674
 
675
 
676
  return primeira, segunda
@@ -939,7 +939,7 @@ class VideoService:
939
  del base_latents; gc.collect(); torch.cuda.empty_cache()
940
 
941
  par = 0
942
- latents_cpu_up = upsampled_latents.detach().to("cpu", non_blocking=True)
943
  torch.cuda.empty_cache()
944
  try:
945
  torch.cuda.ipc_collect()
@@ -957,12 +957,13 @@ class VideoService:
957
 
958
  #latents_parts_up = [latents_cpu_up]
959
 
960
-
961
  for latents in latents_parts_up:
962
 
963
  # # --- ETAPA 3: REFINAMENTO DE TEXTURA (SECOND PASS) ---
964
  print("\n--- INICIANDO ETAPA 3: REFINAMENTO DE TEXTURA (SECOND PASS) ---")
965
-
 
966
  second_pass_config = self.config.get("second_pass", {}).copy()
967
  # --- <INÍCIO DA LÓGICA DE CÁLCULO EXATA PARA SECOND PASS> ---
968
  # Usa as dimensões da primeira passagem dobradas, como na pipeline original
@@ -1021,7 +1022,7 @@ class VideoService:
1021
 
1022
  for latents_vae in latents_list:
1023
 
1024
- latents_cpu_vae = latents_vae.detach().to("cpu", non_blocking=True)
1025
  torch.cuda.empty_cache()
1026
  try:
1027
  torch.cuda.ipc_collect()
@@ -1032,8 +1033,8 @@ class VideoService:
1032
 
1033
 
1034
  lat_a, lat_b = self._dividir_latentes(latents_cpu_vae)
1035
- print(f"[DEBUG] Partição A: {tuple(lat_a.shape)}")
1036
- print(f"[DEBUG] Partição B: {tuple(lat_b.shape)}")
1037
 
1038
  latents_parts_vae = [lat_a, lat_b]
1039
 
 
669
  #if total % 2 == 1: # ÍMPAR
670
  # Ex: 11 → primeira 0..5, segunda 5..10
671
  cut = total // 2
672
+ primeira = latents_brutos[:, :, :cut+1, :, :]
673
+ segunda = latents_brutos[:, :, cut:, :, :]
674
 
675
 
676
  return primeira, segunda
 
939
  del base_latents; gc.collect(); torch.cuda.empty_cache()
940
 
941
  par = 0
942
+ latents_cpu_up = upsampled_latents.to("cpu", non_blocking=True)
943
  torch.cuda.empty_cache()
944
  try:
945
  torch.cuda.ipc_collect()
 
957
 
958
  #latents_parts_up = [latents_cpu_up]
959
 
960
+ par = 1
961
  for latents in latents_parts_up:
962
 
963
  # # --- ETAPA 3: REFINAMENTO DE TEXTURA (SECOND PASS) ---
964
  print("\n--- INICIANDO ETAPA 3: REFINAMENTO DE TEXTURA (SECOND PASS) ---")
965
+ print(f"[DEBUG] Partição {par}: {tuple(lat_bup.shape)}")
966
+ par+=1
967
  second_pass_config = self.config.get("second_pass", {}).copy()
968
  # --- <INÍCIO DA LÓGICA DE CÁLCULO EXATA PARA SECOND PASS> ---
969
  # Usa as dimensões da primeira passagem dobradas, como na pipeline original
 
1022
 
1023
  for latents_vae in latents_list:
1024
 
1025
+ latents_cpu_vae = latents_vae.to("cpu", non_blocking=True)
1026
  torch.cuda.empty_cache()
1027
  try:
1028
  torch.cuda.ipc_collect()
 
1033
 
1034
 
1035
  lat_a, lat_b = self._dividir_latentes(latents_cpu_vae)
1036
+ #print(f"[DEBUG] Partição A: {tuple(lat_a.shape)}")
1037
+ #print(f"[DEBUG] Partição B: {tuple(lat_b.shape)}")
1038
 
1039
  latents_parts_vae = [lat_a, lat_b]
1040