File size: 1,743 Bytes
b219d99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""

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()