Spaces:
Running
on
L4
Running
on
L4
#!/usr/bin/env python3 | |
""" | |
Test script to verify that VERSA is installed correctly. | |
""" | |
import os | |
import sys | |
import subprocess | |
from pathlib import Path | |
# Check if VERSA is installed | |
VERSA_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "versa") | |
def check_versa(): | |
"""Check if VERSA is installed and working""" | |
print("Testing VERSA installation...") | |
if not os.path.exists(VERSA_ROOT): | |
print("VERSA not found.") | |
return False | |
# Check if the scorer.py exists | |
scorer_path = os.path.join(VERSA_ROOT, "versa", "bin", "scorer.py") | |
if not os.path.exists(scorer_path): | |
print(f"VERSA scorer not found at {scorer_path}") | |
return False | |
# Check if the config directory exists | |
config_dir = os.path.join(VERSA_ROOT, "egs") | |
if not os.path.exists(config_dir): | |
print(f"VERSA config directory not found at {config_dir}") | |
return False | |
# Check for available metrics | |
metrics = [] | |
for root, _, files in os.walk(config_dir): | |
for file in files: | |
if file.endswith('.yaml'): | |
metrics.append(os.path.join(root, file)) | |
if not metrics: | |
print("No metric configurations found in VERSA.") | |
return False | |
print(f"Found {len(metrics)} metric configurations.") | |
for metric in metrics[:5]: # Print first 5 metrics | |
print(f"- {os.path.relpath(metric, config_dir)}") | |
if len(metrics) > 5: | |
print(f"... and {len(metrics) - 5} more.") | |
print("VERSA installation looks good!") | |
return True | |
if __name__ == "__main__": | |
check_versa() | |