Update api/ltx_server.py
Browse files- api/ltx_server.py +26 -12
api/ltx_server.py
CHANGED
|
@@ -6,8 +6,20 @@
|
|
| 6 |
import warnings
|
| 7 |
warnings.filterwarnings("ignore", category=UserWarning)
|
| 8 |
warnings.filterwarnings("ignore", category=FutureWarning)
|
| 9 |
-
warnings.filterwarnings("ignore", message=".*
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# --- 1. IMPORTAÇÕES ---
|
| 13 |
import torch
|
|
@@ -30,8 +42,8 @@ import time
|
|
| 30 |
import traceback
|
| 31 |
|
| 32 |
# Singletons (versões simples)
|
| 33 |
-
from vae_manager import vae_manager_singleton
|
| 34 |
-
from video_encode_tool import video_encode_tool_singleton
|
| 35 |
|
| 36 |
# --- 2. GERENCIAMENTO DE DEPENDÊNCIAS E SETUP ---
|
| 37 |
def _query_gpu_processes_via_nvml(device_index: int) -> List[Dict]:
|
|
@@ -116,6 +128,15 @@ def run_setup():
|
|
| 116 |
print(f"[DEBUG] ERRO no setup.py (code {e.returncode}). Abortando.")
|
| 117 |
sys.exit(1)
|
| 118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
DEPS_DIR = Path("/data")
|
| 120 |
LTX_VIDEO_REPO_DIR = DEPS_DIR / "LTX-Video"
|
| 121 |
if not LTX_VIDEO_REPO_DIR.exists():
|
|
@@ -131,14 +152,7 @@ def add_deps_to_path():
|
|
| 131 |
add_deps_to_path()
|
| 132 |
|
| 133 |
# --- 3. IMPORTAÇÕES ESPECÍFICAS DO MODELO ---
|
| 134 |
-
|
| 135 |
-
create_ltx_video_pipeline,
|
| 136 |
-
create_latent_upsampler,
|
| 137 |
-
load_image_to_tensor_with_resize_and_crop,
|
| 138 |
-
seed_everething,
|
| 139 |
-
calculate_padding,
|
| 140 |
-
load_media_file,
|
| 141 |
-
)
|
| 142 |
from ltx_video.pipelines.pipeline_ltx_video import ConditioningItem, LTXMultiScalePipeline
|
| 143 |
from ltx_video.utils.skip_layer_strategy import SkipLayerStrategy
|
| 144 |
|
|
|
|
| 6 |
import warnings
|
| 7 |
warnings.filterwarnings("ignore", category=UserWarning)
|
| 8 |
warnings.filterwarnings("ignore", category=FutureWarning)
|
| 9 |
+
warnings.filterwarnings("ignore", message=".*")
|
| 10 |
+
|
| 11 |
+
from huggingface_hub import logging
|
| 12 |
+
|
| 13 |
+
logging.set_verbosity_error()
|
| 14 |
+
logging.set_verbosity_warning()
|
| 15 |
+
logging.set_verbosity_info()
|
| 16 |
+
logging.set_verbosity_debug()
|
| 17 |
+
|
| 18 |
+
enable_progress_bars()
|
| 19 |
+
LTXV_DEBUG=1
|
| 20 |
+
LTXV_FRAME_LOG_EVERY=8
|
| 21 |
+
|
| 22 |
+
|
| 23 |
|
| 24 |
# --- 1. IMPORTAÇÕES ---
|
| 25 |
import torch
|
|
|
|
| 42 |
import traceback
|
| 43 |
|
| 44 |
# Singletons (versões simples)
|
| 45 |
+
from tools.vae_manager import vae_manager_singleton
|
| 46 |
+
from managers.video_encode_tool import video_encode_tool_singleton
|
| 47 |
|
| 48 |
# --- 2. GERENCIAMENTO DE DEPENDÊNCIAS E SETUP ---
|
| 49 |
def _query_gpu_processes_via_nvml(device_index: int) -> List[Dict]:
|
|
|
|
| 128 |
print(f"[DEBUG] ERRO no setup.py (code {e.returncode}). Abortando.")
|
| 129 |
sys.exit(1)
|
| 130 |
|
| 131 |
+
from api.ltx.inference import (
|
| 132 |
+
create_ltx_video_pipeline,
|
| 133 |
+
create_latent_upsampler,
|
| 134 |
+
load_image_to_tensor_with_resize_and_crop,
|
| 135 |
+
seed_everething,
|
| 136 |
+
calculate_padding,
|
| 137 |
+
load_media_file,
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
DEPS_DIR = Path("/data")
|
| 141 |
LTX_VIDEO_REPO_DIR = DEPS_DIR / "LTX-Video"
|
| 142 |
if not LTX_VIDEO_REPO_DIR.exists():
|
|
|
|
| 152 |
add_deps_to_path()
|
| 153 |
|
| 154 |
# --- 3. IMPORTAÇÕES ESPECÍFICAS DO MODELO ---
|
| 155 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
from ltx_video.pipelines.pipeline_ltx_video import ConditioningItem, LTXMultiScalePipeline
|
| 157 |
from ltx_video.utils.skip_layer_strategy import SkipLayerStrategy
|
| 158 |
|