Spaces:
Runtime error
Runtime error
File size: 2,342 Bytes
69b17de | 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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | """
Setup script for Scam Detection System GPU
Checks GPU availability and provides installation instructions.
"""
import subprocess
import sys
def check_gpu():
"""Check available GPU and provide setup instructions."""
print("=" * 50)
print("GPU Detection for Scam Detection System")
print("=" * 50)
# Check PyTorch
try:
import torch
print(f"\nPyTorch Version: {torch.__version__}")
print(f"CUDA Available: {torch.cuda.is_available()}")
print(f"MPS Available: {torch.backends.mps.is_available() if hasattr(torch.backends, 'mps') else 'N/A'}")
if torch.cuda.is_available():
print(f"GPU: {torch.cuda.get_device_name(0)}")
print(f"VRAM: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.1f} GB")
print("\n✅ GPU is ready! Just run the application.")
return True
except ImportError:
print("PyTorch not installed")
# Check system GPU
result = subprocess.run(["powershell", "-Command",
"Get-WmiObject Win32_VideoController | Select-Object Name"],
capture_output=True, text=True)
print(f"\nSystem GPUs:\n{result.stdout}")
print("\n" + "=" * 50)
print("SETUP INSTRUCTIONS")
print("=" * 50)
print("""
Your system has NVIDIA GPU but CUDA Toolkit is not installed.
OPTION 1: Install CUDA Toolkit (Recommended)
-------------------------------------------
1. Download CUDA Toolkit 11.8 from:
https://developer.nvidia.com/cuda-11-8-0-download-archive
2. Run the installer with default options
3. Install PyTorch with CUDA support:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
4. Restart terminal and run:
python -c "import torch; print('CUDA:', torch.cuda.is_available())"
OPTION 2: Use Intel GPU (Limited)
-------------------------------------------
Install PyTorch with DirectML (Windows):
pip install torch torchvision --index-url https://download.pytorch.org/whl/directml
Note: DirectML has limited features, some models may not work.
OPTION 3: CPU Only (Already Works)
-------------------------------------------
Your current CPU-only setup works for all models,
just runs slower. No changes needed.
""")
return False
if __name__ == "__main__":
check_gpu() |