9e8f1bbeed
Dashboard / frontend (push) Failing after 0s
Dashboard / api (push) Failing after 0s
Lint PowerShell / powershell-lint (ubuntu-latest) (push) Failing after 1s
Python Lint / Lint Python with Ruff (push) Failing after 1s
ShellCheck / Lint shell scripts (push) Failing after 1s
Matrix Smoke / linux-smoke (push) Failing after 1s
Matrix Smoke / distro: cachyos (push) Failing after 15s
Matrix Smoke / distro: linux-mint-21.3 (push) Failing after 15s
Matrix Smoke / distro: debian-12 (push) Failing after 5m21s
Matrix Smoke / distro: fedora-41 (push) Failing after 4m56s
Matrix Smoke / distro: ubuntu-24.04 (push) Failing after 2m13s
Matrix Smoke / distro: rocky-9 (push) Failing after 10m39s
Matrix Smoke / distro: manjaro (push) Failing after 12m11s
Matrix Smoke / distro: opensuse-tw (push) Failing after 11m53s
Matrix Smoke / distro: archlinux (push) Failing after 20m3s
Matrix Smoke / distro: ubuntu-22.04 (push) Failing after 13m49s
Validate .env Schema / tier-1-env-validation (push) Successful in 52s
Validate .env Schema / tier-2-env-validation (push) Successful in 44s
Validate .env Schema / tier-3-env-validation (push) Successful in 52s
Validate .env Schema / tier-4-env-validation (push) Successful in 51s
Validate Extensions Catalog / Check catalog is up-to-date (push) Failing after 9m47s
Secret Scan / Scan for secrets (push) Failing after 21m4s
Validate Docker Compose / Validate Docker Compose files (push) Has been cancelled
Python Type Check / Type check with mypy (push) Has been cancelled
Validate .env Schema / tier-0-env-validation (push) Has been cancelled
Test Linux / integration-smoke (push) Has been cancelled
Lint PowerShell / powershell-lint (windows-latest) (push) Has been cancelled
Matrix Smoke / macos-smoke (push) Has been cancelled
87 lines
2.5 KiB
Python
87 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Pre-flight model validation for ODS offline mode.
|
|
Ensures required models are downloaded before starting services.
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Model requirements for offline mode
|
|
REQUIRED_MODELS = {
|
|
"llm": {
|
|
"path": "data/models",
|
|
"description": "Primary LLM (GGUF model)",
|
|
"size_gb": 4,
|
|
},
|
|
"whisper": {
|
|
"path": "data/whisper/faster-whisper-base",
|
|
"description": "Whisper STT model (base)",
|
|
"size_gb": 0.15,
|
|
},
|
|
"kokoro": {
|
|
"path": "data/kokoro/voices/af_heart.pt",
|
|
"description": "Kokoro TTS voice (af_heart)",
|
|
"size_gb": 0.3,
|
|
},
|
|
"embeddings": {
|
|
"path": "data/embeddings/BAAI/bge-base-en-v1.5",
|
|
"description": "Embedding model (BGE base)",
|
|
"size_gb": 0.4,
|
|
},
|
|
}
|
|
|
|
def check_model(service, config):
|
|
"""Check if a model exists and has reasonable size."""
|
|
# Resolve base path relative to script location (scripts/ -> parent -> ods root)
|
|
base_path = Path(__file__).parent.parent
|
|
model_path = base_path / config["path"]
|
|
|
|
if not model_path.exists():
|
|
return False, f"Not found: {config['path']}"
|
|
|
|
# Check size (rough validation)
|
|
if model_path.is_file():
|
|
size_gb = model_path.stat().st_size / (1024**3)
|
|
else:
|
|
# Directory - sum all files
|
|
size_gb = sum(f.stat().st_size for f in model_path.rglob('*') if f.is_file()) / (1024**3)
|
|
|
|
min_size = config["size_gb"] * 0.5 # At least 50% of expected size
|
|
if size_gb < min_size:
|
|
return False, f"Too small: {size_gb:.2f}GB (expected ~{config['size_gb']}GB)"
|
|
|
|
return True, f"OK: {size_gb:.2f}GB"
|
|
|
|
def main():
|
|
"""Validate all required models are present."""
|
|
print("=" * 60)
|
|
print("ODS Offline Mode - Model Validation")
|
|
print("=" * 60)
|
|
|
|
all_ok = True
|
|
missing = []
|
|
|
|
for service, config in REQUIRED_MODELS.items():
|
|
ok, msg = check_model(service, config)
|
|
status = "✓" if ok else "✗"
|
|
print(f"{status} {config['description']:40s} {msg}")
|
|
|
|
if not ok:
|
|
all_ok = False
|
|
missing.append(service)
|
|
|
|
print("=" * 60)
|
|
|
|
if all_ok:
|
|
print("All models present. Ready for offline mode!")
|
|
return 0
|
|
else:
|
|
print(f"\nMISSING MODELS: {', '.join(missing)}")
|
|
print("\nDownload models before starting offline mode:")
|
|
print(" ./scripts/download-models.sh")
|
|
return 1
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|