Spaces:
Paused
Paused
Update api/ltx/ltx_aduc_pipeline.py
Browse files
api/ltx/ltx_aduc_pipeline.py
CHANGED
|
@@ -164,6 +164,14 @@ class LtxAducPipeline:
|
|
| 164 |
# --- LIFECYCLE & MODEL MANAGEMENT ---
|
| 165 |
# ==========================================================================
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
def _load_config(self) -> Dict:
|
| 168 |
"""Loads the YAML configuration file."""
|
| 169 |
config_path = DEFAULT_CONFIG_FILE
|
|
@@ -242,20 +250,13 @@ class LtxAducPipeline:
|
|
| 242 |
spatial_path = Path(spatial_path_str)
|
| 243 |
if not ckpt_path.is_file():
|
| 244 |
raise FileNotFoundError(f"Main checkpoint file not found: {spatial_path}")
|
| 245 |
-
latent_upsampler =
|
| 246 |
if precision == "bfloat16":
|
| 247 |
latent_upsampler.to(torch.bfloat16)
|
| 248 |
|
| 249 |
logging.info(f"Modelos LTX carregados na CPU em {time.perf_counter()-t0:.2f}s")
|
| 250 |
return pipeline, latent_upsampler
|
| 251 |
|
| 252 |
-
def create_latent_upsampler(latent_upsampler_model_path: str, device: str) -> LatentUpsampler:
|
| 253 |
-
"""Loads the Latent Upsampler model from a checkpoint path."""
|
| 254 |
-
logging.info(f"Loading Latent Upsampler from: {latent_upsampler_model_path} to device: {device}")
|
| 255 |
-
latent_upsampler = LatentUpsampler.from_pretrained(latent_upsampler_model_path)
|
| 256 |
-
latent_upsampler.to(device)
|
| 257 |
-
latent_upsampler.eval()
|
| 258 |
-
return latent_upsampler
|
| 259 |
|
| 260 |
def move_to_device(self, main_device_str: str, vae_device_str: str):
|
| 261 |
"""Moves pipeline components to their target devices."""
|
|
|
|
| 164 |
# --- LIFECYCLE & MODEL MANAGEMENT ---
|
| 165 |
# ==========================================================================
|
| 166 |
|
| 167 |
+
def _create_latent_upsampler(self, latent_upsampler_model_path: str, device: str) -> LatentUpsampler:
|
| 168 |
+
"""Loads the Latent Upsampler model from a checkpoint path."""
|
| 169 |
+
logging.info(f"Loading Latent Upsampler from: {latent_upsampler_model_path} to device: {device}")
|
| 170 |
+
latent_upsampler = LatentUpsampler.from_pretrained(latent_upsampler_model_path)
|
| 171 |
+
latent_upsampler.to(device)
|
| 172 |
+
latent_upsampler.eval()
|
| 173 |
+
return latent_upsampler
|
| 174 |
+
|
| 175 |
def _load_config(self) -> Dict:
|
| 176 |
"""Loads the YAML configuration file."""
|
| 177 |
config_path = DEFAULT_CONFIG_FILE
|
|
|
|
| 250 |
spatial_path = Path(spatial_path_str)
|
| 251 |
if not ckpt_path.is_file():
|
| 252 |
raise FileNotFoundError(f"Main checkpoint file not found: {spatial_path}")
|
| 253 |
+
latent_upsampler = self._create_latent_upsampler(spatial_path, device="cpu")
|
| 254 |
if precision == "bfloat16":
|
| 255 |
latent_upsampler.to(torch.bfloat16)
|
| 256 |
|
| 257 |
logging.info(f"Modelos LTX carregados na CPU em {time.perf_counter()-t0:.2f}s")
|
| 258 |
return pipeline, latent_upsampler
|
| 259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
|
| 261 |
def move_to_device(self, main_device_str: str, vae_device_str: str):
|
| 262 |
"""Moves pipeline components to their target devices."""
|