Download check_zero_gpu_config.py from Ntdeseb/ntia: direct link, hf CLI and curl.
- Browser
- Download file 3.89 kB
-
https://huggingface.co/spaces/Ntdeseb/ntia/resolve/main/check_zero_gpu_config.py
- Command line
-
hf download hf://spaces/Ntdeseb/ntia/check_zero_gpu_config.py
-
curl -L -o check_zero_gpu_config.py https://huggingface.co/spaces/Ntdeseb/ntia/resolve/main/check_zero_gpu_config.py
3.89 kB
| #!/usr/bin/env python3 | |
| """ | |
| Script para verificar la configuración de ZeroGPU en el Space NTIA | |
| """ | |
| import os | |
| import torch | |
| def check_zero_gpu_config(): | |
| """Verificar la configuración de ZeroGPU""" | |
| print("🔍 Verificando configuración de ZeroGPU...") | |
| print("=" * 60) | |
| # 1. Verificar variables de entorno | |
| print("📋 Variables de entorno:") | |
| print(f" SPACES_GPU_TIMEOUT: {os.getenv('SPACES_GPU_TIMEOUT', 'No configurado')}") | |
| print(f" SPACES_GPU_MEMORY: {os.getenv('SPACES_GPU_MEMORY', 'No configurado')}") | |
| print(f" HF_TOKEN: {'Configurado' if os.getenv('HF_TOKEN') else 'No configurado'}") | |
| # 2. Verificar GPU | |
| print("\n🎮 Información de GPU:") | |
| if torch.cuda.is_available(): | |
| print(f" ✅ CUDA disponible: {torch.cuda.is_available()}") | |
| print(f" 🎮 GPU: {torch.cuda.get_device_name(0)}") | |
| print(f" 💾 Memoria total: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.1f} GB") | |
| print(f" 🔥 Capacidad CUDA: {torch.cuda.get_device_capability()}") | |
| # Verificar si es H200 (Plan Pro) | |
| gpu_name = torch.cuda.get_device_name(0) | |
| if "H200" in gpu_name: | |
| print(" ✅ ZeroGPU H200 detectado - Plan Pro activo") | |
| else: | |
| print(f" ⚠️ GPU detectada: {gpu_name}") | |
| print(" 💡 Considera actualizar al plan Pro") | |
| else: | |
| print(" ❌ CUDA no disponible") | |
| # 3. Verificar configuración de spaces (simulado) | |
| print("\n🔧 Configuración de Spaces:") | |
| print(" 📊 Decoradores configurados:") | |
| print(" - @spaces.GPU(compute_unit='gpu.h200.micro', timeout=30)") | |
| print(" - @spaces.GPU(compute_unit='gpu.h200.micro', timeout=60)") | |
| # 4. Verificar optimizaciones | |
| print("\n⚡ Optimizaciones CUDA:") | |
| print(f" 🔧 torch.backends.cudnn.benchmark: {torch.backends.cudnn.benchmark}") | |
| print(f" 🔧 torch.backends.cuda.matmul.allow_tf32: {torch.backends.cuda.matmul.allow_tf32}") | |
| print(f" 🔧 torch.backends.cudnn.allow_tf32: {torch.backends.cudnn.allow_tf32}") | |
| # 5. Verificar tipo de datos | |
| print("\n📊 Configuración de tipos de datos:") | |
| if torch.cuda.is_available(): | |
| torch_dtype = torch.float16 | |
| print(" ⚡ Usando torch.float16 para H200") | |
| else: | |
| torch_dtype = torch.float32 | |
| print(" 🐌 Usando torch.float32 para CPU") | |
| # 6. Recomendaciones | |
| print("\n💡 Recomendaciones:") | |
| if torch.cuda.is_available(): | |
| gpu_name = torch.cuda.get_device_name(0) | |
| if "H200" in gpu_name: | |
| print(" ✅ Configuración correcta para Plan Pro") | |
| print(" 🚀 El Space está usando ZeroGPU H200") | |
| else: | |
| print(" ⚠️ Considera actualizar al plan Pro") | |
| print(" 💡 Plan Pro incluye H200 con 25 minutos/día") | |
| else: | |
| print(" ❌ No se detectó GPU") | |
| print(" 💡 Verifica la configuración del Space") | |
| # 7. Verificar archivo app.py | |
| print("\n📁 Verificación de archivo app.py:") | |
| try: | |
| with open('app.py', 'r', encoding='utf-8') as f: | |
| content = f.read() | |
| # Verificar decoradores | |
| if "gpu.h200.micro" in content: | |
| print(" ✅ Decoradores H200 configurados correctamente") | |
| else: | |
| print(" ❌ Decoradores H200 no encontrados") | |
| # Verificar configuración de ZeroGPU | |
| if "ZeroGPU H200 detectado" in content: | |
| print(" ✅ Configuración H200 detectada") | |
| else: | |
| print(" ⚠️ Configuración H200 no encontrada") | |
| except FileNotFoundError: | |
| print(" ❌ Archivo app.py no encontrado") | |
| print("\n" + "=" * 60) | |
| print("✅ Verificación completada") | |
| if __name__ == "__main__": | |
| check_zero_gpu_config() |