eeuuia commited on
Commit
febdd12
·
verified ·
1 Parent(s): 73f7fd9

Update api/ltx/ltx_utils.py

Browse files
Files changed (1) hide show
  1. api/ltx/ltx_utils.py +6 -0
api/ltx/ltx_utils.py CHANGED
@@ -27,6 +27,8 @@ from huggingface_hub import logging as ll
27
  ll.set_verbosity_error()
28
  ll.set_verbosity_warning()
29
  ll.set_verbosity_info()
 
 
30
  ll.set_verbosity_debug()
31
 
32
 
@@ -58,6 +60,7 @@ if repo_path not in sys.path:
58
  # --- FUNÇÕES DE CONSTRUÇÃO DE MODELO E PIPELINE ---
59
  # ==============================================================================
60
 
 
61
  def create_latent_upsampler(latent_upsampler_model_path: str, device: str) -> LatentUpsampler:
62
  """Loads the Latent Upsampler model from a checkpoint path."""
63
  logging.info(f"Loading Latent Upsampler from: {latent_upsampler_model_path} to device: {device}")
@@ -66,6 +69,7 @@ def create_latent_upsampler(latent_upsampler_model_path: str, device: str) -> La
66
  latent_upsampler.eval()
67
  return latent_upsampler
68
 
 
69
  def build_ltx_pipeline_on_cpu(config: Dict) -> Tuple[LTXVideoPipeline, Optional[torch.nn.Module]]:
70
  """Builds the complete LTX pipeline and upsampler on the CPU."""
71
  t0 = time.perf_counter()
@@ -122,6 +126,7 @@ def build_ltx_pipeline_on_cpu(config: Dict) -> Tuple[LTXVideoPipeline, Optional[
122
  # --- FUNÇÕES AUXILIARES (Seed, Preparação de Imagem) ---
123
  # ==============================================================================
124
 
 
125
  def seed_everything(seed: int):
126
  """Sets the seed for reproducibility."""
127
  random.seed(seed)
@@ -132,6 +137,7 @@ def seed_everything(seed: int):
132
  torch.backends.cudnn.deterministic = True
133
  torch.backends.cudnn.benchmark = False
134
 
 
135
  def load_image_to_tensor_with_resize_and_crop(
136
  image_input: Union[str, Image.Image],
137
  target_height: int,
 
27
  ll.set_verbosity_error()
28
  ll.set_verbosity_warning()
29
  ll.set_verbosity_info()
30
+ from utils.debug_utils import log_function_io
31
+
32
  ll.set_verbosity_debug()
33
 
34
 
 
60
  # --- FUNÇÕES DE CONSTRUÇÃO DE MODELO E PIPELINE ---
61
  # ==============================================================================
62
 
63
+ @log_function_io
64
  def create_latent_upsampler(latent_upsampler_model_path: str, device: str) -> LatentUpsampler:
65
  """Loads the Latent Upsampler model from a checkpoint path."""
66
  logging.info(f"Loading Latent Upsampler from: {latent_upsampler_model_path} to device: {device}")
 
69
  latent_upsampler.eval()
70
  return latent_upsampler
71
 
72
+ @log_function_io
73
  def build_ltx_pipeline_on_cpu(config: Dict) -> Tuple[LTXVideoPipeline, Optional[torch.nn.Module]]:
74
  """Builds the complete LTX pipeline and upsampler on the CPU."""
75
  t0 = time.perf_counter()
 
126
  # --- FUNÇÕES AUXILIARES (Seed, Preparação de Imagem) ---
127
  # ==============================================================================
128
 
129
+ @log_function_io
130
  def seed_everything(seed: int):
131
  """Sets the seed for reproducibility."""
132
  random.seed(seed)
 
137
  torch.backends.cudnn.deterministic = True
138
  torch.backends.cudnn.benchmark = False
139
 
140
+ @log_function_io
141
  def load_image_to_tensor_with_resize_and_crop(
142
  image_input: Union[str, Image.Image],
143
  target_height: int,