Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,10 +7,36 @@ import uuid
|
|
| 7 |
import shutil
|
| 8 |
from tqdm import tqdm
|
| 9 |
import threading
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def print_thread_count(tag=""):
|
| 12 |
print(f"[DEBUG] {tag} Thread count:", len(threading.enumerate()))
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
from huggingface_hub import snapshot_download, list_repo_files, hf_hub_download
|
| 16 |
import importlib, site
|
|
@@ -295,7 +321,7 @@ def run_pipeline(prompt_text, steps, image_paths, audio_file_path, max_duration
|
|
| 295 |
tea_cache_l1_thresh = 0.0,
|
| 296 |
progress_bar_cmd=progress
|
| 297 |
)
|
| 298 |
-
|
| 299 |
|
| 300 |
# Return resulting video path
|
| 301 |
video_path = os.path.join(output_dir, f"{filename}.mp4")
|
|
|
|
| 7 |
import shutil
|
| 8 |
from tqdm import tqdm
|
| 9 |
import threading
|
| 10 |
+
import psutil, os
|
| 11 |
+
|
| 12 |
+
def print_open_files(tag=""):
|
| 13 |
+
pid = os.getpid()
|
| 14 |
+
p = psutil.Process(pid)
|
| 15 |
+
print(f"[DEBUG] {tag} Open file descriptors:", p.num_fds())
|
| 16 |
+
|
| 17 |
+
def print_process_count(tag=""):
|
| 18 |
+
proc_count = len(psutil.pids())
|
| 19 |
+
print(f"[DEBUG] {tag} Process count:", proc_count)
|
| 20 |
|
| 21 |
def print_thread_count(tag=""):
|
| 22 |
print(f"[DEBUG] {tag} Thread count:", len(threading.enumerate()))
|
| 23 |
|
| 24 |
+
def print_ffmpeg_processes(tag=""):
|
| 25 |
+
count = 0
|
| 26 |
+
for p in psutil.process_iter(['name', 'cmdline']):
|
| 27 |
+
if 'ffmpeg' in (p.info['name'] or '') or \
|
| 28 |
+
any('ffmpeg' in (arg or '') for arg in (p.info['cmdline'] or [])):
|
| 29 |
+
count += 1
|
| 30 |
+
print(f"[DEBUG] {tag} FFmpeg running:", count)
|
| 31 |
+
|
| 32 |
+
def debug_resources(tag=""):
|
| 33 |
+
print("========== RESOURCE DEBUG", tag, "==========")
|
| 34 |
+
print_thread_count()
|
| 35 |
+
print_process_count()
|
| 36 |
+
print_ffmpeg_processes()
|
| 37 |
+
print_open_files()
|
| 38 |
+
print("============================================")
|
| 39 |
+
|
| 40 |
|
| 41 |
from huggingface_hub import snapshot_download, list_repo_files, hf_hub_download
|
| 42 |
import importlib, site
|
|
|
|
| 321 |
tea_cache_l1_thresh = 0.0,
|
| 322 |
progress_bar_cmd=progress
|
| 323 |
)
|
| 324 |
+
debug_resources("after generation")
|
| 325 |
|
| 326 |
# Return resulting video path
|
| 327 |
video_path = os.path.join(output_dir, f"{filename}.mp4")
|