- Add docs/audio/tts-research.md with Voxtral TTS, Kokoro-FastAPI, openedai-speech comparison - Add docs/audio/stt-research.md with Voxtral STT, faster-whisper options - Add docs/gpu/optimization.md with OLLAMA_KEEP_ALIVE and VRAM management - Add docs/README.md with architecture overview - Add index files for docs navigation Research conducted April 2026 for future audio improvements
181 lines
4.1 KiB
Markdown
181 lines
4.1 KiB
Markdown
# GPU Optimization - Avril 2026
|
|
|
|
## Contexte
|
|
Optimisation GPU pour éviter le blocage de la RX 7800 XT 16GB par Ollama et les services TTS/STT.
|
|
|
|
---
|
|
|
|
## Problème Initial
|
|
**Symptôme**: GPU bloqué à 100% utilisation malgré l'inactivité
|
|
**Cause**: `OLLAMA_KEEP_ALIVE=-1` (défaut) - modèles chargés indéfiniment en VRAM
|
|
|
|
---
|
|
|
|
## Solutions Appliquées
|
|
|
|
### 1. OLLAMA_KEEP_ALIVE=0 ✅ APPLIQUÉ
|
|
|
|
#### Configuration
|
|
```bash
|
|
# Fichier: /etc/systemd/system/ollama.service.d/override.conf
|
|
[Service]
|
|
Environment=OLLAMA_KEEP_ALIVE=0
|
|
```
|
|
|
|
#### Application
|
|
```bash
|
|
# Redémarrer le service Ollama
|
|
sudo systemctl restart ollama
|
|
|
|
# Vérifier
|
|
systemctl show ollama | grep Environment
|
|
# Doit afficher: OLLAMA_KEEP_ALIVE=0
|
|
```
|
|
|
|
#### Vérification
|
|
```bash
|
|
# Test: faire une requête puis vérifier VRAM
|
|
curl -s http://localhost:11434/api/ps
|
|
# Doit montrer "models": [] après requête
|
|
|
|
rocm-smi --showmeminfo vram
|
|
# Doit montrer ~3-9% VRAM après requête (idle)
|
|
```
|
|
|
|
---
|
|
|
|
### 2. WoL Proxy Timeout ⚠️ MODIFIÉ
|
|
|
|
#### Configuration Actuelle
|
|
```python
|
|
# wol-proxy/app.py
|
|
WAKE_TIMEOUT = 60 # Secondes
|
|
timeout = 600 # Ancien: 10 minutes (problème)
|
|
```
|
|
|
|
#### Problème
|
|
- Timeout de 600s (10 minutes) maintenait les connexions longues
|
|
- Empêchait Ollama de décharger les modèles
|
|
|
|
#### Solution
|
|
- Réduire `timeout` à une valeur plus basse
|
|
- Ou utiliser `keep_alive=0` dans les requêtes
|
|
|
|
---
|
|
|
|
## Surveillance GPU
|
|
|
|
### Commandes Utiles
|
|
```bash
|
|
# VRAM et utilisation GPU
|
|
rocm-smi --showmeminfo vram --showuse
|
|
|
|
# Watching en temps réel
|
|
watch -n 1 rocm-smi --showmeminfo vram --showuse
|
|
|
|
# Vérifier processus Ollama
|
|
ps aux | grep ollama
|
|
|
|
# Forcer déchargement si nécessaire
|
|
~/scripts/kill-ollama.sh
|
|
```
|
|
|
|
### Scripts Disponibles
|
|
| Script | Fonction |
|
|
|--------|----------|
|
|
| `~/scripts/kill-ollama.sh` | Tuer processus Ollama bloquants |
|
|
| `~/scripts/configure-ollama-antiblock.sh` | Configure OLLAMA_KEEP_ALIVE=0 |
|
|
| `~/Documents/OpenCode/Projets/Effi/scripts/diagnose-gpu.sh` | Diagnostic GPU |
|
|
| `~/Documents/OpenCode/Projets/Effi/scripts/debug-gpu.sh` | Debug avancé |
|
|
|
|
---
|
|
|
|
## VRAM par Service
|
|
|
|
### Configuration Actuelle
|
|
| Service | VRAM | Emplacement |
|
|
|---------|------|-------------|
|
|
| Ollama (qwen3.5:latest, Q4_K_M) | ~2.5GB | Fedora (192.168.1.11) |
|
|
| openedai-speech (XTTS) | ~4GB | Ubuntu (192.168.1.27) |
|
|
| faster-whisper | CPU | Ubuntu (192.168.1.27) |
|
|
|
|
### Options TTS avec VRAM
|
|
| Solution | VRAM | Notes |
|
|
|----------|------|-------|
|
|
| Voxtral TTS (BF16) | 16GB+ | Trop lourd |
|
|
| Voxtral TTS (Q4 GGUF) | ~3GB | Incompatible vLLM-Omni |
|
|
| Kokoro-FastAPI | ~2-4GB | ✅ Compatible |
|
|
| openedai-speech | ~4GB | Actuel |
|
|
|
|
---
|
|
|
|
## Problèmes Connus
|
|
|
|
### 1. expires_at: 4 heures
|
|
**Symptôme**: Modèle charge avec `expires_at` 4h dans le futur même avec KEEP_ALIVE=0
|
|
|
|
**Causes possibles**:
|
|
- OpenWebUI envoie `keep_alive` custom dans les requêtes
|
|
- WoL proxy timeout
|
|
- Configuration OpenWebUI
|
|
|
|
**Investigation**:
|
|
```bash
|
|
# Vérifier si OpenWebUI envoie keep_alive custom
|
|
ssh ubuntu-server "docker exec open-webui env | grep -i keep"
|
|
|
|
# Vérifier logs OpenWebUI
|
|
docker logs open-webui -f
|
|
```
|
|
|
|
### 2. Stuck Runner Processes
|
|
**Symptôme**: Processus `ollama runner` restent en mémoire
|
|
|
|
**Solution**:
|
|
```bash
|
|
# Identifier les processus
|
|
ps aux | grep "ollama runner"
|
|
|
|
# Tuer manuellement
|
|
kill -9 <PID>
|
|
|
|
# Ou utiliser le script
|
|
~/scripts/kill-ollama.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Monitoring Recommandé
|
|
|
|
### Beszel + Dozzle (Planifié)
|
|
Installation prévue sur Synology (192.168.1.25):
|
|
- **Beszel Hub**: 8090 (surveillance CPU/RAM/GPU)
|
|
- **Dozzle**: 8888 (logs Docker)
|
|
|
|
Agents sur:
|
|
- **Folzo Corp** (Fedora): Agent Beszel
|
|
- **Effi-Serveur** (Ubuntu): Agent Beszel
|
|
|
|
---
|
|
|
|
## Checklist GPU
|
|
|
|
- [x] OLLAMA_KEEP_ALIVE=0 configuré
|
|
- [x] Service Ollama redémarré
|
|
- [x] WoL proxy timeout réduit
|
|
- [ ] VRAM vérifiée après usage
|
|
- [ ] Monitoring Beszel+Dozzle installé
|
|
- [ ] SSH Synology réparé
|
|
|
|
---
|
|
|
|
## Références
|
|
- [Ollama Keep Alive Docs](https://github.com/ollama/ollama/blob/main/docs/faq.md#how-do-i-keep-models-loaded-in-memory)
|
|
- [ROCm SMI](https://docs.amd.com/bestfoundrydocs/rocm-docs/latest/tools/rocm-smi.html)
|
|
- [vLLM-Omni](https://github.com/vllm-project/vllm-omni)
|
|
|
|
---
|
|
|
|
*Document créé: Avril 2026*
|
|
*Dernière mise à jour: Avril 2026*
|