euiiiia commited on
Commit
f0b8c63
·
verified ·
1 Parent(s): ee39a80

Update api/ltx_server_refactored.py

Browse files
Files changed (1) hide show
  1. api/ltx_server_refactored.py +12 -0
api/ltx_server_refactored.py CHANGED
@@ -517,6 +517,8 @@ class VideoService:
517
  "frame_rate": int(DEFAULT_FPS),
518
  "generator": torch.Generator(device=self.device).manual_seed(used_seed),
519
  "output_type": "latent",
 
 
520
  "conditioning_items": conditioning_items,
521
  "guidance_scale": float(guidance_scale),
522
  **(self.config.get("first_pass", {}))
@@ -561,6 +563,16 @@ class VideoService:
561
  if LTXV_DEBUG:
562
  print(f"[DEBUG] Diretório temporário removido: {d}")
563
 
 
 
 
 
 
 
 
 
 
 
564
  def _load_config(self, config_filename: str) -> Dict:
565
  """Carrega o arquivo de configuração YAML."""
566
  config_path = LTX_VIDEO_REPO_DIR / "configs" / config_filename
 
517
  "frame_rate": int(DEFAULT_FPS),
518
  "generator": torch.Generator(device=self.device).manual_seed(used_seed),
519
  "output_type": "latent",
520
+ "vae_per_channel_normalize": True,
521
+ "is_video": True,
522
  "conditioning_items": conditioning_items,
523
  "guidance_scale": float(guidance_scale),
524
  **(self.config.get("first_pass", {}))
 
563
  if LTXV_DEBUG:
564
  print(f"[DEBUG] Diretório temporário removido: {d}")
565
 
566
+ def _save_latents_to_disk(self, latents_tensor: torch.Tensor, base_filename: str, seed: int) -> str:
567
+ """Salva um tensor de latentes em um arquivo .pt."""
568
+ latents_cpu = latents_tensor.detach().to("cpu")
569
+ tensor_path = RESULTS_DIR / f"{base_filename}_{seed}.pt"
570
+ torch.save(latents_cpu, tensor_path)
571
+ if LTXV_DEBUG:
572
+ print(f"[DEBUG] Latentes salvos em: {tensor_path}")
573
+ return str(tensor_path)
574
+
575
+
576
  def _load_config(self, config_filename: str) -> Dict:
577
  """Carrega o arquivo de configuração YAML."""
578
  config_path = LTX_VIDEO_REPO_DIR / "configs" / config_filename