Hhh / verify_setup.py
Ksjsjjdj's picture
Upload 34 files
b219d99 verified
Raw
History Blame Contribute Delete
1.74 kB
"""
Simple local verification script to ensure the environment is prepared and the model is downloaded.
"""
import os
import sys
def check_venv_python():
if sys.prefix == sys.base_prefix:
print("Not in a virtual environment; consider activating .venv")
else:
print(f"Virtualenv detected: {sys.prefix}")
def check_models_dir():
models_dir = "models"
if not os.path.exists(models_dir):
print("Models directory not found. Run download_models.py first.")
return False
files = [f for f in os.listdir(models_dir) if f.endswith('.pth')]
if not files:
print("No .pth files found in ./models. Run download_models.py to fetch model weights.")
return False
print(f"Found model files: {files}")
return True
def check_dependencies():
try:
import importlib
packages = [
'fastapi', 'uvicorn', 'rwkv', 'huggingface_hub', 'pydantic', 'loguru'
]
missing = []
for p in packages:
if importlib.util.find_spec(p) is None:
missing.append(p)
if missing:
print(f"Missing packages: {missing}; install them in your venv")
return False
print("All key dependencies found.")
return True
except Exception as e:
print(f"Dependency check failed: {e}")
return False
def main():
check_venv_python()
deps_ok = check_dependencies()
models_ok = check_models_dir()
if deps_ok and models_ok:
print("Environment appears configured. You can run: python app.py")
else:
print("Fix missing items and re-run verification.")
if __name__ == '__main__':
main()