Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Quick dependency checker for LLM translation | |
| Run this before test_llm_translation.py to verify all dependencies are installed | |
| """ | |
| import sys | |
| def check_package(package_name, import_name=None): | |
| """Check if a package is installed""" | |
| if import_name is None: | |
| import_name = package_name | |
| try: | |
| __import__(import_name) | |
| print(f"✅ {package_name}") | |
| return True | |
| except ImportError: | |
| print(f"❌ {package_name} - NOT INSTALLED") | |
| return False | |
| def main(): | |
| print("=" * 60) | |
| print("Checking Dependencies for LLM Translation") | |
| print("=" * 60) | |
| print() | |
| required = [ | |
| ("torch", "torch"), | |
| ("transformers", "transformers"), | |
| ("numpy", "numpy"), | |
| ("psutil", "psutil"), | |
| ] | |
| optional = [ | |
| ("bitsandbytes", "bitsandbytes"), # For quantization | |
| ("accelerate", "accelerate"), # For efficient loading | |
| ] | |
| print("Required packages:") | |
| print("-" * 60) | |
| required_ok = all(check_package(name, import_name) for name, import_name in required) | |
| print() | |
| print("Optional packages (for quantization):") | |
| print("-" * 60) | |
| optional_ok = all(check_package(name, import_name) for name, import_name in optional) | |
| print() | |
| print("=" * 60) | |
| if required_ok: | |
| print("✅ All required packages are installed!") | |
| if not optional_ok: | |
| print("⚠️ Optional packages missing (quantization may not work)") | |
| print(" Install with: pip install bitsandbytes accelerate") | |
| print() | |
| print("You can now run: python test_llm_translation.py") | |
| return 0 | |
| else: | |
| print("❌ Some required packages are missing!") | |
| print() | |
| print("Install missing packages with:") | |
| print(" pip install -r requirements.txt") | |
| return 1 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |