Panacea ICONO
commited on
Commit
·
d1346c6
1
Parent(s):
53b3be9
Add application file
Browse files- Dockerfile +32 -0
- app.py +332 -0
- requirements.txt +22 -0
Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
+
# Dockerfile optimizado para el espacio DRDELATV/gpt-local
|
| 3 |
+
|
| 4 |
+
FROM python:3.9-slim
|
| 5 |
+
|
| 6 |
+
# Crear usuario no root para seguridad
|
| 7 |
+
RUN useradd -m -u 1000 user
|
| 8 |
+
USER user
|
| 9 |
+
|
| 10 |
+
# Configurar PATH para el usuario
|
| 11 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Establecer directorio de trabajo
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
|
| 16 |
+
# Copiar requirements y instalar dependencias
|
| 17 |
+
COPY --chown=user ./requirements_hf.txt requirements.txt
|
| 18 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copiar archivos de la aplicación
|
| 21 |
+
COPY --chown=user ./app.py /app/app.py
|
| 22 |
+
|
| 23 |
+
# Variables de entorno para optimización
|
| 24 |
+
ENV PYTHONUNBUFFERED=1
|
| 25 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 26 |
+
ENV HF_HUB_OFFLINE=0
|
| 27 |
+
|
| 28 |
+
# Exponer puerto 7860 (estándar de HF Spaces)
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Comando para ejecutar la aplicación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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
🚀 GPT Local - Espacio Hugging Face
|
| 4 |
+
FastAPI Application para el espacio DRDELATV/gpt-local
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from fastapi import FastAPI, HTTPException
|
| 8 |
+
from fastapi.responses import HTMLResponse
|
| 9 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 10 |
+
from pydantic import BaseModel
|
| 11 |
+
import os
|
| 12 |
+
import json
|
| 13 |
+
from typing import List, Dict, Any, Optional
|
| 14 |
+
import time
|
| 15 |
+
import logging
|
| 16 |
+
|
| 17 |
+
# Configurar logging
|
| 18 |
+
logging.basicConfig(level=logging.INFO)
|
| 19 |
+
logger = logging.getLogger(__name__)
|
| 20 |
+
|
| 21 |
+
app = FastAPI(
|
| 22 |
+
title="GPT Local - DRDELATV",
|
| 23 |
+
description="Sistema GPT Local con soporte para modelos sin censura y entrenamiento personalizado",
|
| 24 |
+
version="1.0.0",
|
| 25 |
+
docs_url="/docs",
|
| 26 |
+
redoc_url="/redoc"
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
# Configurar CORS
|
| 30 |
+
app.add_middleware(
|
| 31 |
+
CORSMiddleware,
|
| 32 |
+
allow_origins=["*"],
|
| 33 |
+
allow_credentials=True,
|
| 34 |
+
allow_methods=["*"],
|
| 35 |
+
allow_headers=["*"],
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
# Modelos de datos
|
| 39 |
+
class ChatMessage(BaseModel):
|
| 40 |
+
role: str
|
| 41 |
+
content: str
|
| 42 |
+
|
| 43 |
+
class ChatRequest(BaseModel):
|
| 44 |
+
messages: List[ChatMessage]
|
| 45 |
+
model: Optional[str] = "mistralai/Mistral-7B-v0.1"
|
| 46 |
+
max_tokens: Optional[int] = 512
|
| 47 |
+
temperature: Optional[float] = 0.7
|
| 48 |
+
|
| 49 |
+
class ChatResponse(BaseModel):
|
| 50 |
+
response: str
|
| 51 |
+
model_used: str
|
| 52 |
+
tokens_generated: int
|
| 53 |
+
processing_time: float
|
| 54 |
+
|
| 55 |
+
# Base de datos de modelos disponibles
|
| 56 |
+
AVAILABLE_MODELS = {
|
| 57 |
+
"mistralai/Mistral-7B-v0.1": {
|
| 58 |
+
"name": "Mistral 7B Base",
|
| 59 |
+
"description": "Modelo base para uso general",
|
| 60 |
+
"type": "general",
|
| 61 |
+
"censored": True
|
| 62 |
+
},
|
| 63 |
+
"NousResearch/Nous-Hermes-2-Mistral-7B-DPO": {
|
| 64 |
+
"name": "Nous Hermes 2 (Sin Censura)",
|
| 65 |
+
"description": "Modelo optimizado sin restricciones de contenido",
|
| 66 |
+
"type": "uncensored",
|
| 67 |
+
"censored": False
|
| 68 |
+
},
|
| 69 |
+
"ehartford/dolphin-2.6-mistral-7b": {
|
| 70 |
+
"name": "Dolphin 2.6 (Sin Restricciones)",
|
| 71 |
+
"description": "Modelo sin filtros para conversación libre",
|
| 72 |
+
"type": "uncensored",
|
| 73 |
+
"censored": False
|
| 74 |
+
},
|
| 75 |
+
"teknium/OpenHermes-2.5-Mistral-7B": {
|
| 76 |
+
"name": "OpenHermes 2.5",
|
| 77 |
+
"description": "Modelo para conversación libre y creativa",
|
| 78 |
+
"type": "creative",
|
| 79 |
+
"censored": False
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
@app.get("/", response_class=HTMLResponse)
|
| 84 |
+
async def home():
|
| 85 |
+
"""Página principal del espacio GPT Local"""
|
| 86 |
+
html_content = """
|
| 87 |
+
<!DOCTYPE html>
|
| 88 |
+
<html lang="es">
|
| 89 |
+
<head>
|
| 90 |
+
<meta charset="UTF-8">
|
| 91 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 92 |
+
<title>🚀 GPT Local - DRDELATV</title>
|
| 93 |
+
<style>
|
| 94 |
+
body {
|
| 95 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 96 |
+
margin: 0;
|
| 97 |
+
padding: 20px;
|
| 98 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 99 |
+
color: white;
|
| 100 |
+
min-height: 100vh;
|
| 101 |
+
}
|
| 102 |
+
.container {
|
| 103 |
+
max-width: 1200px;
|
| 104 |
+
margin: 0 auto;
|
| 105 |
+
background: rgba(255, 255, 255, 0.1);
|
| 106 |
+
backdrop-filter: blur(10px);
|
| 107 |
+
border-radius: 20px;
|
| 108 |
+
padding: 30px;
|
| 109 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
| 110 |
+
}
|
| 111 |
+
h1 {
|
| 112 |
+
text-align: center;
|
| 113 |
+
font-size: 2.5em;
|
| 114 |
+
margin-bottom: 30px;
|
| 115 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
| 116 |
+
}
|
| 117 |
+
.feature-grid {
|
| 118 |
+
display: grid;
|
| 119 |
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
| 120 |
+
gap: 20px;
|
| 121 |
+
margin: 30px 0;
|
| 122 |
+
}
|
| 123 |
+
.feature-card {
|
| 124 |
+
background: rgba(255, 255, 255, 0.15);
|
| 125 |
+
border-radius: 15px;
|
| 126 |
+
padding: 20px;
|
| 127 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 128 |
+
}
|
| 129 |
+
.api-section {
|
| 130 |
+
background: rgba(0, 0, 0, 0.2);
|
| 131 |
+
border-radius: 15px;
|
| 132 |
+
padding: 20px;
|
| 133 |
+
margin: 20px 0;
|
| 134 |
+
}
|
| 135 |
+
.endpoint {
|
| 136 |
+
background: rgba(255, 255, 255, 0.1);
|
| 137 |
+
border-radius: 10px;
|
| 138 |
+
padding: 15px;
|
| 139 |
+
margin: 10px 0;
|
| 140 |
+
font-family: 'Courier New', monospace;
|
| 141 |
+
}
|
| 142 |
+
.btn {
|
| 143 |
+
display: inline-block;
|
| 144 |
+
padding: 12px 24px;
|
| 145 |
+
background: rgba(255, 255, 255, 0.2);
|
| 146 |
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
| 147 |
+
border-radius: 10px;
|
| 148 |
+
color: white;
|
| 149 |
+
text-decoration: none;
|
| 150 |
+
margin: 10px;
|
| 151 |
+
transition: all 0.3s ease;
|
| 152 |
+
}
|
| 153 |
+
.btn:hover {
|
| 154 |
+
background: rgba(255, 255, 255, 0.3);
|
| 155 |
+
transform: translateY(-2px);
|
| 156 |
+
}
|
| 157 |
+
</style>
|
| 158 |
+
</head>
|
| 159 |
+
<body>
|
| 160 |
+
<div class="container">
|
| 161 |
+
<h1>🚀 GPT Local - DRDELATV</h1>
|
| 162 |
+
|
| 163 |
+
<div class="feature-grid">
|
| 164 |
+
<div class="feature-card">
|
| 165 |
+
<h3>🤖 Modelos Sin Censura</h3>
|
| 166 |
+
<p>Acceso a modelos como Dolphin, Nous-Hermes y OpenHermes sin restricciones de contenido</p>
|
| 167 |
+
</div>
|
| 168 |
+
|
| 169 |
+
<div class="feature-card">
|
| 170 |
+
<h3>🔧 Entrenamiento Personalizado</h3>
|
| 171 |
+
<p>Sistema QLoRA para fine-tuning con tus propios datasets</p>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<div class="feature-card">
|
| 175 |
+
<h3>📊 Datasets Personalizados</h3>
|
| 176 |
+
<p>Creación de datasets conversacionales, creativos y sin censura</p>
|
| 177 |
+
</div>
|
| 178 |
+
|
| 179 |
+
<div class="feature-card">
|
| 180 |
+
<h3>🌐 API REST Completa</h3>
|
| 181 |
+
<p>FastAPI con documentación automática y endpoints optimizados</p>
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
|
| 185 |
+
<div class="api-section">
|
| 186 |
+
<h2>🔌 API Endpoints</h2>
|
| 187 |
+
|
| 188 |
+
<div class="endpoint">
|
| 189 |
+
<strong>GET /</strong> - Página principal
|
| 190 |
+
</div>
|
| 191 |
+
|
| 192 |
+
<div class="endpoint">
|
| 193 |
+
<strong>GET /health</strong> - Estado del sistema
|
| 194 |
+
</div>
|
| 195 |
+
|
| 196 |
+
<div class="endpoint">
|
| 197 |
+
<strong>GET /models</strong> - Lista de modelos disponibles
|
| 198 |
+
</div>
|
| 199 |
+
|
| 200 |
+
<div class="endpoint">
|
| 201 |
+
<strong>POST /chat</strong> - Chat con el modelo
|
| 202 |
+
</div>
|
| 203 |
+
|
| 204 |
+
<div class="endpoint">
|
| 205 |
+
<strong>GET /status</strong> - Estadísticas del sistema
|
| 206 |
+
</div>
|
| 207 |
+
</div>
|
| 208 |
+
|
| 209 |
+
<div style="text-align: center; margin: 30px 0;">
|
| 210 |
+
<a href="/docs" class="btn">📚 Documentación API</a>
|
| 211 |
+
<a href="/redoc" class="btn">📖 ReDoc</a>
|
| 212 |
+
<a href="/health" class="btn">❤️ Estado</a>
|
| 213 |
+
<a href="/models" class="btn">🤖 Modelos</a>
|
| 214 |
+
</div>
|
| 215 |
+
|
| 216 |
+
<div style="text-align: center; margin-top: 40px; font-size: 0.9em; opacity: 0.8;">
|
| 217 |
+
<p>🏗️ Construido con FastAPI + Transformers + QLoRA</p>
|
| 218 |
+
<p>🔗 Repositorio: <a href="https://github.com/DRDELATV/gpt-local" style="color: #fff;">github.com/DRDELATV/gpt-local</a></p>
|
| 219 |
+
</div>
|
| 220 |
+
</div>
|
| 221 |
+
</body>
|
| 222 |
+
</html>
|
| 223 |
+
"""
|
| 224 |
+
return HTMLResponse(content=html_content)
|
| 225 |
+
|
| 226 |
+
@app.get("/health")
|
| 227 |
+
async def health_check():
|
| 228 |
+
"""Verificar estado del sistema"""
|
| 229 |
+
return {
|
| 230 |
+
"status": "healthy",
|
| 231 |
+
"service": "GPT Local - DRDELATV",
|
| 232 |
+
"version": "1.0.0",
|
| 233 |
+
"timestamp": time.time(),
|
| 234 |
+
"models_available": len(AVAILABLE_MODELS),
|
| 235 |
+
"space_url": "https://huggingface.co/spaces/DRDELATV/gpt-local"
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
@app.get("/models")
|
| 239 |
+
async def get_models():
|
| 240 |
+
"""Obtener lista de modelos disponibles"""
|
| 241 |
+
return {
|
| 242 |
+
"models": AVAILABLE_MODELS,
|
| 243 |
+
"total_models": len(AVAILABLE_MODELS),
|
| 244 |
+
"uncensored_models": len([m for m in AVAILABLE_MODELS.values() if not m["censored"]]),
|
| 245 |
+
"default_model": "mistralai/Mistral-7B-v0.1"
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
@app.post("/chat", response_model=ChatResponse)
|
| 249 |
+
async def chat_with_model(request: ChatRequest):
|
| 250 |
+
"""Chat con el modelo seleccionado"""
|
| 251 |
+
start_time = time.time()
|
| 252 |
+
|
| 253 |
+
# Validar modelo
|
| 254 |
+
if request.model not in AVAILABLE_MODELS:
|
| 255 |
+
raise HTTPException(
|
| 256 |
+
status_code=400,
|
| 257 |
+
detail=f"Modelo no disponible. Use uno de: {list(AVAILABLE_MODELS.keys())}"
|
| 258 |
+
)
|
| 259 |
+
|
| 260 |
+
# Simular procesamiento (en un deployment real, aquí cargarías el modelo)
|
| 261 |
+
logger.info(f"Procesando chat con modelo: {request.model}")
|
| 262 |
+
|
| 263 |
+
# Construir prompt
|
| 264 |
+
conversation = ""
|
| 265 |
+
for msg in request.messages:
|
| 266 |
+
conversation += f"{msg.role}: {msg.content}\n"
|
| 267 |
+
|
| 268 |
+
# Respuesta simulada (en producción usarías el modelo real)
|
| 269 |
+
model_info = AVAILABLE_MODELS[request.model]
|
| 270 |
+
response_text = f"""¡Hola! Soy un asistente basado en {model_info['name']}.
|
| 271 |
+
|
| 272 |
+
📋 Tu mensaje: {request.messages[-1].content if request.messages else 'Sin mensaje'}
|
| 273 |
+
|
| 274 |
+
🤖 Características del modelo:
|
| 275 |
+
- Nombre: {model_info['name']}
|
| 276 |
+
- Tipo: {model_info['type']}
|
| 277 |
+
- Sin censura: {'✅' if not model_info['censored'] else '❌'}
|
| 278 |
+
|
| 279 |
+
🔧 Configuración:
|
| 280 |
+
- Temperatura: {request.temperature}
|
| 281 |
+
- Max tokens: {request.max_tokens}
|
| 282 |
+
|
| 283 |
+
Este es el espacio DRDELATV/gpt-local funcionando correctamente. En un deployment completo, aquí se cargaría el modelo real usando transformers y se generaría una respuesta auténtica.
|
| 284 |
+
|
| 285 |
+
Para usar el sistema completo:
|
| 286 |
+
1. Clona el repositorio completo
|
| 287 |
+
2. Instala las dependencias
|
| 288 |
+
3. Ejecuta el entrenamiento personalizado
|
| 289 |
+
4. Usa los modelos sin censura disponibles
|
| 290 |
+
"""
|
| 291 |
+
|
| 292 |
+
processing_time = time.time() - start_time
|
| 293 |
+
|
| 294 |
+
return ChatResponse(
|
| 295 |
+
response=response_text,
|
| 296 |
+
model_used=request.model,
|
| 297 |
+
tokens_generated=len(response_text.split()),
|
| 298 |
+
processing_time=processing_time
|
| 299 |
+
)
|
| 300 |
+
|
| 301 |
+
@app.get("/status")
|
| 302 |
+
async def get_status():
|
| 303 |
+
"""Estadísticas del sistema"""
|
| 304 |
+
return {
|
| 305 |
+
"service": "GPT Local API",
|
| 306 |
+
"author": "DRDELATV",
|
| 307 |
+
"space": "https://huggingface.co/spaces/DRDELATV/gpt-local",
|
| 308 |
+
"github": "https://github.com/DRDELATV/gpt-local",
|
| 309 |
+
"features": [
|
| 310 |
+
"Modelos sin censura",
|
| 311 |
+
"Entrenamiento QLoRA",
|
| 312 |
+
"Datasets personalizados",
|
| 313 |
+
"API REST completa",
|
| 314 |
+
"Interfaz web",
|
| 315 |
+
"Docker support"
|
| 316 |
+
],
|
| 317 |
+
"models": {
|
| 318 |
+
"total": len(AVAILABLE_MODELS),
|
| 319 |
+
"uncensored": len([m for m in AVAILABLE_MODELS.values() if not m["censored"]]),
|
| 320 |
+
"available": list(AVAILABLE_MODELS.keys())
|
| 321 |
+
},
|
| 322 |
+
"deployment": {
|
| 323 |
+
"platform": "Hugging Face Spaces",
|
| 324 |
+
"runtime": "Docker",
|
| 325 |
+
"framework": "FastAPI",
|
| 326 |
+
"python_version": "3.9"
|
| 327 |
+
}
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
if __name__ == "__main__":
|
| 331 |
+
import uvicorn
|
| 332 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
requirements.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GPT Local - DRDELATV Space Requirements
|
| 2 |
+
fastapi==0.104.1
|
| 3 |
+
uvicorn[standard]==0.24.0
|
| 4 |
+
pydantic==2.5.0
|
| 5 |
+
python-multipart==0.0.6
|
| 6 |
+
transformers==4.36.0
|
| 7 |
+
torch==2.1.0
|
| 8 |
+
accelerate>=0.25.0
|
| 9 |
+
huggingface-hub>=0.19.0
|
| 10 |
+
gradio>=4.7.0
|
| 11 |
+
datasets>=2.14.0
|
| 12 |
+
|
| 13 |
+
# Para entrenamiento avanzado (QLoRA)
|
| 14 |
+
peft>=0.7.0
|
| 15 |
+
trl>=0.7.4
|
| 16 |
+
bitsandbytes>=0.41.3
|
| 17 |
+
|
| 18 |
+
# Utilidades y herramientas
|
| 19 |
+
numpy>=1.24.0
|
| 20 |
+
requests>=2.31.0
|
| 21 |
+
tqdm>=4.64.0
|
| 22 |
+
colorama>=0.4.6
|