Add secure documentation for ZeroGPU Plan Pro fix
Browse files- README_ZEROGPU_FIX.md +125 -0
README_ZEROGPU_FIX.md
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 🔧 ZeroGPU Plan Pro Fix - NTIA Space
|
2 |
+
|
3 |
+
## 📋 Problema Resuelto
|
4 |
+
|
5 |
+
El Space NTIA estaba usando el **plan gratuito de ZeroGPU** (`gpu.t4.micro`) en lugar del **plan Pro** (`gpu.h200.micro`), causando errores "GPU task aborted".
|
6 |
+
|
7 |
+
## ✅ Correcciones Implementadas
|
8 |
+
|
9 |
+
### 1. **Decoradores ZeroGPU Corregidos**
|
10 |
+
|
11 |
+
**Antes:**
|
12 |
+
```python
|
13 |
+
@spaces.GPU(compute_unit="gpu.t4.micro", timeout=30)
|
14 |
+
@spaces.GPU(compute_unit="gpu.t4.micro", timeout=60)
|
15 |
+
```
|
16 |
+
|
17 |
+
**Después:**
|
18 |
+
```python
|
19 |
+
@spaces.GPU(compute_unit="gpu.h200.micro", timeout=30) # Plan Pro: H200
|
20 |
+
@spaces.GPU(compute_unit="gpu.h200.micro", timeout=60) # Plan Pro: H200
|
21 |
+
```
|
22 |
+
|
23 |
+
### 2. **Configuración de Verificación**
|
24 |
+
|
25 |
+
Agregado al `app.py`:
|
26 |
+
```python
|
27 |
+
# Configuración específica para ZeroGPU Plan Pro
|
28 |
+
print("🔧 Configurando ZeroGPU Plan Pro...")
|
29 |
+
print("📊 Plan Pro: H200 con 25 minutos/día")
|
30 |
+
print("🎯 Compute Unit: gpu.h200.micro")
|
31 |
+
|
32 |
+
# Verificar plan Pro
|
33 |
+
if torch.cuda.is_available():
|
34 |
+
gpu_name = torch.cuda.get_device_name(0)
|
35 |
+
if "H200" in gpu_name:
|
36 |
+
print("✅ ZeroGPU H200 detectado - Plan Pro activo")
|
37 |
+
```
|
38 |
+
|
39 |
+
### 3. **Funciones de Verificación**
|
40 |
+
|
41 |
+
```python
|
42 |
+
def check_auth(): # Verificar autenticación
|
43 |
+
def check_quota(): # Verificar estado de cuota
|
44 |
+
def get_space_status(): # Estado completo del Space
|
45 |
+
```
|
46 |
+
|
47 |
+
## 📊 Comparación de Planes
|
48 |
+
|
49 |
+
| Característica | Plan Gratuito | Plan Pro |
|
50 |
+
|----------------|---------------|----------|
|
51 |
+
| GPU | T4 | H200 |
|
52 |
+
| Memoria | 16GB | 69.5GB |
|
53 |
+
| Velocidad | Estándar | 3x más rápido |
|
54 |
+
| Compute Unit | `gpu.t4.micro` | `gpu.h200.micro` |
|
55 |
+
|
56 |
+
## 🔧 Configuración Requerida
|
57 |
+
|
58 |
+
### Variables de Entorno del Space:
|
59 |
+
```
|
60 |
+
HF_TOKEN=tu_token_aqui
|
61 |
+
SPACES_GPU_TIMEOUT=30
|
62 |
+
SPACES_GPU_MEMORY=8
|
63 |
+
```
|
64 |
+
|
65 |
+
### Plan Pro Activo:
|
66 |
+
- Verificar en Settings → Billing
|
67 |
+
- ZeroGPU Plan Pro debe estar activo
|
68 |
+
|
69 |
+
## 🚀 Optimizaciones
|
70 |
+
|
71 |
+
### Configuración H200:
|
72 |
+
- ⚡ `torch.float16` para velocidad
|
73 |
+
- 🔧 Optimizaciones CUDA habilitadas
|
74 |
+
- 🎯 Configuración específica para H200
|
75 |
+
|
76 |
+
### Timeouts Optimizados:
|
77 |
+
- 🎨 Imágenes: 30 segundos
|
78 |
+
- 🎬 Videos: 60 segundos
|
79 |
+
|
80 |
+
### Parámetros Optimizados:
|
81 |
+
- SDXL Turbo: 1 paso, guidance=0.0
|
82 |
+
- SD Turbo: 2 pasos, guidance≤1.0
|
83 |
+
- Modelos estándar: 15 pasos máximo
|
84 |
+
|
85 |
+
## 📁 Archivos Modificados
|
86 |
+
|
87 |
+
1. **`app.py`** - Decoradores y configuración principal
|
88 |
+
2. **`check_zero_gpu_config.py`** - Script de verificación
|
89 |
+
|
90 |
+
## 🔍 Verificación
|
91 |
+
|
92 |
+
### Script de Verificación:
|
93 |
+
```bash
|
94 |
+
python check_zero_gpu_config.py
|
95 |
+
```
|
96 |
+
|
97 |
+
### Logs Esperados:
|
98 |
+
```
|
99 |
+
🔧 Configurando ZeroGPU Plan Pro...
|
100 |
+
📊 Plan Pro: H200 con 25 minutos/día
|
101 |
+
🎯 Compute Unit: gpu.h200.micro
|
102 |
+
✅ ZeroGPU H200 detectado - Plan Pro activo
|
103 |
+
```
|
104 |
+
|
105 |
+
## ⚠️ Próximos Pasos
|
106 |
+
|
107 |
+
1. **Verificar Plan Pro** en Hugging Face
|
108 |
+
2. **Configurar variables de entorno** del Space
|
109 |
+
3. **Probar generación** de imágenes/videos
|
110 |
+
4. **Verificar logs** del Space
|
111 |
+
|
112 |
+
## 📞 Troubleshooting
|
113 |
+
|
114 |
+
### Error: "GPU task aborted"
|
115 |
+
- Verificar plan Pro en Hugging Face
|
116 |
+
- Confirmar variables de entorno del Space
|
117 |
+
|
118 |
+
### Error: "Cuota agotada"
|
119 |
+
- Verificar tiempo restante del plan Pro
|
120 |
+
- Esperar reinicio diario de cuota
|
121 |
+
|
122 |
+
---
|
123 |
+
|
124 |
+
**Estado:** ✅ Correcciones implementadas y desplegadas
|
125 |
+
**Space:** https://huggingface.co/spaces/Ntdeseb/ntia
|