Spaces:
Paused
Paused
Update api/ltx/ltx_aduc_pipeline.py
Browse files- api/ltx/ltx_aduc_pipeline.py +10 -3
api/ltx/ltx_aduc_pipeline.py
CHANGED
|
@@ -54,7 +54,7 @@ add_deps_to_path()
|
|
| 54 |
|
| 55 |
# --- PROJECT IMPORTS ---
|
| 56 |
try:
|
| 57 |
-
from ltx_video.pipelines.pipeline_ltx_video import LTXVideoPipeline
|
| 58 |
from ltx_video.models.autoencoders.causal_video_autoencoder import CausalVideoAutoencoder
|
| 59 |
from ltx_video.models.transformers.transformer3d import Transformer3DModel
|
| 60 |
from ltx_video.models.transformers.symmetric_patchifier import SymmetricPatchifier
|
|
@@ -63,7 +63,7 @@ try:
|
|
| 63 |
from safetensors import safe_open
|
| 64 |
from api.gpu_manager import gpu_manager
|
| 65 |
from ltx_video.models.autoencoders.vae_encode import (normalize_latents, un_normalize_latents)
|
| 66 |
-
from ltx_video.pipelines.pipeline_ltx_video import (ConditioningItem, LTXMultiScalePipeline, adain_filter_latent
|
| 67 |
from ltx_video.utils.inference_utils import load_image_to_tensor_with_resize_and_crop
|
| 68 |
from managers.vae_manager import vae_manager_singleton
|
| 69 |
from tools.video_encode_tool import video_encode_tool_singleton
|
|
@@ -248,7 +248,14 @@ class LtxAducPipeline:
|
|
| 248 |
|
| 249 |
logging.info(f"Modelos LTX carregados na CPU em {time.perf_counter()-t0:.2f}s")
|
| 250 |
return pipeline, latent_upsampler
|
| 251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
|
| 253 |
def move_to_device(self, main_device_str: str, vae_device_str: str):
|
| 254 |
"""Moves pipeline components to their target devices."""
|
|
|
|
| 54 |
|
| 55 |
# --- PROJECT IMPORTS ---
|
| 56 |
try:
|
| 57 |
+
from ltx_video.pipelines.pipeline_ltx_video import LTXVideoPipeline # E outros...
|
| 58 |
from ltx_video.models.autoencoders.causal_video_autoencoder import CausalVideoAutoencoder
|
| 59 |
from ltx_video.models.transformers.transformer3d import Transformer3DModel
|
| 60 |
from ltx_video.models.transformers.symmetric_patchifier import SymmetricPatchifier
|
|
|
|
| 63 |
from safetensors import safe_open
|
| 64 |
from api.gpu_manager import gpu_manager
|
| 65 |
from ltx_video.models.autoencoders.vae_encode import (normalize_latents, un_normalize_latents)
|
| 66 |
+
from ltx_video.pipelines.pipeline_ltx_video import (ConditioningItem, LTXMultiScalePipeline, adain_filter_latent)
|
| 67 |
from ltx_video.utils.inference_utils import load_image_to_tensor_with_resize_and_crop
|
| 68 |
from managers.vae_manager import vae_manager_singleton
|
| 69 |
from tools.video_encode_tool import video_encode_tool_singleton
|
|
|
|
| 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."""
|