Files
TalkEdit/utils/validation.py

39 lines
1.1 KiB
Python
Raw Normal View History

2025-01-28 17:00:03 -05:00
from pathlib import Path
import shutil
import logging
2025-01-28 17:00:03 -05:00
logger = logging.getLogger(__name__)
def validate_environment(obs_path: Path = None):
2025-01-28 17:00:03 -05:00
"""Validate environment and prerequisites."""
errors = []
if obs_path and not obs_path.exists():
errors.append(f"Directory not found: {obs_path}")
if not shutil.which("ffmpeg"):
errors.append("FFmpeg is not installed or not in PATH. Install it from https://ffmpeg.org/download.html")
2025-01-28 17:00:03 -05:00
return errors
def get_system_capabilities():
"""Return a dict of detected system capabilities for display."""
import torch
caps = {
"ffmpeg": shutil.which("ffmpeg") is not None,
"cuda": torch.cuda.is_available(),
"mps": hasattr(torch.backends, "mps") and torch.backends.mps.is_available(),
"gpu_name": None,
"gpu_memory": None,
}
if caps["cuda"] and torch.cuda.device_count() > 0:
props = torch.cuda.get_device_properties(0)
caps["gpu_name"] = props.name
caps["gpu_memory"] = props.total_memory
return caps