Spaces:
Build error
Build error
File size: 3,151 Bytes
34b8b49 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
import os
import sys
import importlib.util
import subprocess
# Define required directories
required_dirs = [
"omni_speech",
"omni_speech/serve",
"omni_speech/infer",
"vocoder"
]
# Define required files
required_files = [
"app.py",
"omni_speech/__init__.py",
"omni_speech/serve/__init__.py",
"omni_speech/serve/controller.py",
"omni_speech/serve/model_worker.py",
"omni_speech/serve/gradio_web_server.py",
"omni_speech/infer/__init__.py",
"omni_speech/infer/inference.py",
"omni_speech/infer/run.sh"
]
# Define required packages
required_packages = [
"torch",
"transformers",
"gradio",
"fastapi",
"uvicorn",
"pydantic",
"numpy",
"tqdm"
]
def check_directory_structure():
"""Check if all required directories exist."""
print("Checking directory structure...")
missing_dirs = []
for dir_path in required_dirs:
if not os.path.isdir(dir_path):
missing_dirs.append(dir_path)
if missing_dirs:
print(f"β Missing directories: {', '.join(missing_dirs)}")
return False
else:
print("β
All required directories exist.")
return True
def check_required_files():
"""Check if all required files exist."""
print("Checking required files...")
missing_files = []
for file_path in required_files:
if not os.path.isfile(file_path):
missing_files.append(file_path)
if missing_files:
print(f"β Missing files: {', '.join(missing_files)}")
return False
else:
print("β
All required files exist.")
return True
def check_packages():
"""Check if all required packages are installed."""
print("Checking required packages...")
missing_packages = []
for package in required_packages:
if importlib.util.find_spec(package) is None:
missing_packages.append(package)
if missing_packages:
print(f"β Missing packages: {', '.join(missing_packages)}")
return False
else:
print("β
All required packages are installed.")
return True
def check_python_version():
"""Check if Python version is compatible."""
print("Checking Python version...")
major, minor = sys.version_info[:2]
if major != 3 or minor < 10:
print(f"β Incompatible Python version: {major}.{minor}. Python 3.10+ is required.")
return False
else:
print(f"β
Python version is compatible: {major}.{minor}")
return True
def main():
"""Run all checks."""
print("π Checking LLaMA-Omni setup...")
print("-" * 50)
checks = [
check_directory_structure(),
check_required_files(),
check_packages(),
check_python_version()
]
print("-" * 50)
if all(checks):
print("β
All checks passed! LLaMA-Omni is set up correctly.")
print("π Run 'python app.py' to start the application.")
else:
print("β Some checks failed. Please fix the issues before running the application.")
if __name__ == "__main__":
main() |