diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..55ed45c --- /dev/null +++ b/docs/README.md @@ -0,0 +1,102 @@ +# Documentation Audio & GPU - Effi + +Documentation technique pour les composants audio (TTS/STT) et l'optimisation GPU. + +## 📚 Contenu + +### Audio +- [TTS Research](audio/tts-research.md) - Recherche sur les solutions Text-to-Speech +- [STT Research](audio/stt-research.md) - Recherche sur les solutions Speech-to-Text + +### GPU +- [GPU Optimization](gpu/optimization.md) - Optimisation VRAM et Ollama + +--- + +## 🗺️ Architecture Audio Actuelle + +``` +┌─────────────────────────────────────────────────────────────┐ +│ Fedora (192.168.1.11) │ +│ │ +│ ┌─────────────┐ ┌─────────────────────────────────┐ │ +│ │ Ollama │ │ effi-stt (STT) │ │ +│ │ qwen3.5 │ │ faster-whisper large-v3 │ │ +│ │ (Q4_K_M) │ │ Port: 8200 │ │ +│ │ Port: 11434 │ └─────────────────────────────────┘ │ +│ └─────────────┘ │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Effi-Serveur (192.168.1.27) │ +│ │ +│ ┌─────────────┐ ┌─────────────┐ ┌──────────────┐ │ +│ │ OpenWebUI │ │ WoL Proxy │ │ Whisper │ │ +│ │ Port: 3000 │───▶│ Port: 3011 │───▶│ (unused) │ │ +│ └─────────────┘ └─────────────┘ └──────────────┘ │ +│ │ +│ ┌─────────────────────────────────────────────────────┐ │ +│ │ openedai-speech (TTS) │ │ +│ │ Piper + XTTS v2, Port: 8100 │ │ +│ │ ⚠️ ARCHIVED - pas de mises à jour │ │ +│ └─────────────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Synology (192.168.1.25) │ +│ │ +│ Services planning: │ +│ - Beszel Hub: 8090 (monitoring) │ +│ - Dozzle: 8888 (logs Docker) │ +└─────────────────────────────────────────────────────────────┘ +``` + +--- + +## 📊 Résumé des Services + +| Service | Port | Status | Notes | +|---------|------|--------|-------| +| Ollama | 11434 | ✅ Actif | qwen3.5:latest | +| effi-stt | 8200 | ✅ Actif | faster-whisper large-v3 | +| openedai-speech | 8100 | ⚠️ Archivé | XTTS v2 | +| OpenWebUI | 3000 | ✅ Actif | Ubuntu | +| WoL Proxy | 3011 | ✅ Actif | Ubuntu | + +--- + +## 🔮 Améliorations Futures + +### TTS (Text-to-Speech) +1. **Voxtral TTS** (priorité haute) + - Surveillance: vLLM-Omni supporter quantization + - Requiert: 16GB VRAM (BF16) ou solution Q4 + +2. **Kokoro-FastAPI** (si Voxtral indisponible) + - Léger (~2-4GB VRAM) + - Voix française limitée (`ff_swis` Grade B-) + +### STT (Speech-to-Text) +1. **Voxtral STT** (surveillance) + - OpenWebUI support natif (API Mistral) + - Option cloud ou local si VRAM disponible + +### Monitoring +1. **Beszel** - Surveillance CPU/RAM/GPU +2. **Dozzle** - Logs Docker temps réel + +--- + +## 🔗 Liens Utiles + +- [Gitea Effi](https://gitea.folzocorp.fr/Folzo/effi) +- [OpenWebUI Docs](https://docs.openwebui.com/) +- [vLLM-Omni](https://github.com/vllm-project/vllm-omni) +- [Kokoro-FastAPI](https://github.com/remsky/Kokoro-FastAPI) +- [Mistral Voxtral](https://mistral.ai/news/voxtral-tts) + +--- + +*Dernière mise à jour: Avril 2026* diff --git a/docs/audio/README.md b/docs/audio/README.md new file mode 100644 index 0000000..1236984 --- /dev/null +++ b/docs/audio/README.md @@ -0,0 +1,24 @@ +# Audio Documentation + +## Fichiers +- [TTS Research](tts-research.md) - Recherche solutions Text-to-Speech +- [STT Research](stt-research.md) - Recherche solutions Speech-to-Text + +## Résumé + +### TTS (Text-to-Speech) +| Solution | Status | VRAM | Notes | +|----------|--------|------|-------| +| openedai-speech | ✅ Production | ~4GB | Archivé | +| Voxtral TTS | 🔬 Recherche | 16GB+ | En attente quantization | +| Kokoro-FastAPI | 🔬 Alternative | ~2-4GB | Si Voxtral indisponible | + +### STT (Speech-to-Text) +| Solution | Status | Compute | Notes | +|----------|--------|---------|-------| +| faster-whisper | ✅ Production | CPU | Actuel | +| Voxtral STT | 🔬 Recherche | GPU | Cloud API possible | + +--- + +*Dernière mise à jour: Avril 2026* diff --git a/docs/audio/stt-research.md b/docs/audio/stt-research.md new file mode 100644 index 0000000..7e37a32 --- /dev/null +++ b/docs/audio/stt-research.md @@ -0,0 +1,157 @@ +# STT (Speech-to-Text) Research - Avril 2026 + +## Objectif +Évaluer les solutions STT pour intégrer Voxtral de Mistral ou améliorer faster-whisper. + +--- + +## Solutions Évaluées + +### 1. Voxtral STT (Mistral) ⭐ INTÉRÊT FUTUR + +#### Caractéristiques +| Caractéristique | Valeur | +|-----------------|--------| +| **Modèle** | `mistralai/Voxtral-Mini-4B-Realtime-2602` | +| **Type** | Streaming ASR (Speech-to-Text) | +| **License** | Apache-2.0 ✅ | +| **Langues** | 13 | +| **VRAM** | ≥16GB (BF16) | +| **Source** | [Hugging Face](https://huggingface.co/mistralai/Voxtral-Mini-4B-Realtime-2602) | + +#### Avantages +- ✅ OpenWebUI support natif via API Mistral +- ✅ Streaming avec latence configurable (80ms - 2400ms) +- ✅ Apache-2.0 license +- ✅ Peut tourner sur vLLM ou Transformers + +#### Inconvénients +- ⚠️ 16GB VRAM minimum (BF16) +- ⚠️ Requiert configuration spéciale pour streaming + +#### Configuration OpenWebUI (Cloud API) +```yaml +Speech-to-Text Engine: MistralAI +API Key: your-mistral-api-key +STT Model: voxtral-mini-latest +``` + +#### Alternative: Voxtral Mini Transcribe 2 +| Modèle | Type | Description | +|--------|------|-------------| +| `voxtral-mini-transcribe-26-02` | Premier | Dernière version | +| `voxtral-mini-transcribe-realtime-26-02` | Open | Streaming temps réel | + +--- + +### 2. Faster-Whisper (Actuel) 🔵 EN PRODUCTION + +#### Caractéristiques +| Caractéristique | Valeur | +|-----------------|--------| +| **Modèle** | `Systran/faster-whisper-large-v3` | +| **Compute** | CPU (int8) | +| **Langue** | Français | +| **API** | Custom FastAPI (effi-stt) | +| **Port** | 8200 | + +#### Avantages +- ✅ Fonctionne actuellement en production +- ✅ Gratuit (pas d'API key) +- ✅ Local (vie privée) +- ✅ Performance acceptable sur CPU + +#### Inconvénients +- ⚠️ CPU only (plus lent que GPU) +- ⚠️ Utilisation effi-stt custom (à maintenir) + +#### Setup Actuel +```yaml +# OpenWebUI Configuration +AUDIO_STT_ENGINE: openai +AUDIO_STT_OPENAI_API_BASE_URL: http://192.168.1.11:8200/v1 +AUDIO_STT_OPENAI_API_KEY: anything +AUDIO_STT_MODEL: Systran/faster-whisper-large-v3 +``` + +#### Code Source +`effi-stt/main.py` - FastAPI wrapper autour de faster-whisper + +--- + +### 3. Whisper OpenAI API (Cloud) + +#### Caractéristiques +| Caractéristique | Valeur | +|-----------------|--------| +| **Modèle** | whisper-1 | +| **Coût** | Payant (par minute) | +| **API Key** | OpenAI requise | + +#### Configuration OpenWebUI +```yaml +Speech-to-Text Engine: OpenAI +API Key: your-openai-api-key +``` + +--- + +## Comparatif STT + +| Critère | Voxtral (Cloud) | Faster-Whisper | Whisper (Cloud) | +|---------|------------------|----------------|-----------------| +| **Coût** | Per-minute | Gratuit | Payant | +| **Vie privée** | ❌ Cloud | ✅ Local | ❌ Cloud | +| **VRAM** | 16GB+ (si local) | 0 (CPU) | 0 | +| **OpenWebUI** | Natif | Custom API | Natif | +| **French** | ✅ | ✅ | ✅ | + +--- + +## Recommandations + +### Pour Usage Personnel (Actuel) +**Garder faster-whisper** car: +- Gratuit et local +- Fonctionne bien pour le français +- Pas de dépendance cloud + +### Pour Amélioration Future +**Considérer Voxtral si:** +- OpenWebUI intègre le support natif local +- Vous avez un GPU avec ≥16GB VRAM disponible +- Vous voulez améliorer la qualité + +--- + +## Notes Techniques + +### Modèles Faster-Whisper Disponibles +| Modèle | Paramètres | Langues | Taille | +|--------|------------|---------|--------| +| tiny | 39M | 99 | ~75MB | +| base | 74M | 99 | ~150MB | +| small | 244M | 99 | ~500MB | +| medium | 769M | 99 | ~1.5GB | +| large-v3 | 1.56B | 99 | ~3GB | + +### Configuration ACTUELLE +```python +# effi-stt/main.py +MODEL_SIZE = "large-v3" +DEVICE = "cpu" +COMPUTE_TYPE = "int8" +LANGUAGE = "fr" +``` + +--- + +## Sources +- [Voxtral Mini Transcribe](https://huggingface.co/mistralai/Voxtral-Mini-4B-Realtime-2602) +- [Faster-Whisper](https://github.com/SYSTRAN/faster-whisper) +- [OpenWebUI STT Docs](https://docs.openwebui.com/features/chat-conversations/audio/speech-to-text/) + +--- + +*Document créé: Avril 2026* +*Dernière mise à jour: Avril 2026* diff --git a/docs/audio/tts-research.md b/docs/audio/tts-research.md new file mode 100644 index 0000000..ee22815 --- /dev/null +++ b/docs/audio/tts-research.md @@ -0,0 +1,187 @@ +# TTS (Text-to-Speech) Research - April 2026 + +## Objectif +Évaluer les solutions TTS pour intégrer Voxtral de Mistral ou améliorer la solution existante (openedai-speech). + +--- + +## Solutions Évaluées + +### 1. Voxtral TTS (Mistral) ⭐ PRIORITÉ FUTURE + +#### Caractéristiques +| Caractéristique | Valeur | +|-----------------|--------| +| **Modèle** | `mistralai/Voxtral-4B-TTS-2603` | +| **Taille** | 4B paramètres | +| **License** | CC BY-NC 4.0 (non-commercial) | +| **Langues** | 9 (English, French, German, Spanish, Dutch, Portuguese, Italian, Hindi, Arabic) | +| **Source** | [Hugging Face](https://huggingface.co/mistralai/Voxtral-4B-TTS-2603) | + +#### VRAM Requirements +| Quantization | VRAM | Status | +|--------------|------|--------| +| BF16 (original) | 16GB+ | ✅ Fonctionne avec vLLM-Omni | +| F16 | ~9GB | ❌ Non supporté par vLLM-Omni | +| Q8_0 | ~5GB | ❌ Non supporté par vLLM-Omni | +| Q4 (GGUF) | ~3GB | ❌ Non supporté par vLLM-Omni | + +#### Limitations Actuelles +- **vLLM-Omni ne supporte que le modèle BF16 officiel** (16GB VRAM minimum) +- Les quantizations GGUF (Q4, Q8) utilisent llama.cpp/Burn et ne sont pas compatibles +- Votre RX 7800 XT 16GB est pile à la limite + +#### Installation (si VRAM résolu) +```bash +# Option Docker +docker run -d \ + --name voxtral-tts \ + --runtime rocm \ + --ipc=host \ + -p 8000:8000 \ + -v ~/.cache/huggingface:/root/.cache/huggingface \ + vllm/vllm-omni:v0.18.0 \ + vllm serve mistralai/Voxtral-4B-TTS-2603 --omni +``` + +#### Configuration OpenWebUI +```yaml +TTS Engine: OpenAI +API Base URL: http://192.168.1.11:8000/v1 +Model: mistralai/Voxtral-4B-TTS-2603 +Voice: casual_male # ou autre voix française +``` + +#### Voix Disponibles +20 voix préconfigurées + adaptation avec 3-25s d'audio de référence + +#### Points de Surveillance +- [ ] Vérifier si vLLM supporte les quantizations pour Voxtral +- [ ] Surveiller les releases vLLM-Omni pour support quantization +- [ ] Alternative: utiliser API Mistral (cloud) si local trop lourd + +--- + +### 2. Kokoro-FastAPI ✅ RECOMMANDÉ SI UPGRADE + +#### Caractéristiques +| Caractéristique | Valeur | +|-----------------|--------| +| **Modèle** | Kokoro-82M (StyleTTS 2) | +| **Taille** | 82 million paramètres | +| **License** | Apache 2.0 ✅ | +| **VRAM** | ~2-4 GB | +| **Source** | [GitHub](https://github.com/remsky/Kokoro-FastAPI) | + +#### Avantages +- ✅ Léger (~2-4GB VRAM) - ne bloquera pas le GPU +- ✅ 54+ voix prêtes à l'emploi +- ✅ Voice mixing (combiner voix avec poids) +- ✅ TTS Arena #2 (open-weight, Elo 1056) +- ✅ OpenWebUI bien documenté +- ✅ Development actif (4.7k stars) +- ✅ Apache 2.0 (usage commercial OK) + +#### Inconvénients +- ⚠️ **Voix française limitée**: `ff_swis` (Grade B-, <11h training data) +- ❌ Pas de voice cloning natif + +#### Installation +```bash +# GPU (NVIDIA - pas ROCm pour l'instant) +docker run --gpus all -p 8880:8880 ghcr.io/remsky/kokoro-fastapi-gpu:latest + +# CPU (fallback) +docker run -p 8880:8880 ghcr.io/remsky/kokoro-fastapi-cpu:latest +``` + +#### Configuration OpenWebUI +```yaml +TTS Engine: OpenAI +API Base URL: http://host.docker.internal:8880/v1 +API Key: not-needed +Model: kokoro +Voice: af_bella # ou autre voix +``` + +#### Voix Françaises +| Voice | Type | Grade | Notes | +|-------|------|-------|-------| +| `ff_swis` | Female | B- | <11 hours training data | + +--- + +### 3. Openedai-Speech (Actuel) 🔵 EN PRODUCTION + +#### Caractéristiques +| Caractéristique | Valeur | +|-----------------|--------| +| **Modèle** | Piper TTS + XTTS v2 | +| **License** | AGPL-3.0 | +| **VRAM** | ~4 GB (XTTS) | +| **Status** | **ARCHIVED** ⚠️ | +| **Source** | [GitHub](https://github.com/matatonic/openedai-speech) | + +#### Avantages +- ✅ Fonctionne actuellement en production +- ✅ Voice cloning avec XTTS v2 (6-30 sec audio) +- ✅ 16 langues supportées +- ✅ Vous avez déjà des voix françaises téléchargées + +#### Inconvénients +- ⚠️ **Archivé** - plus de mises à jour +- ⚠️ AGPL-3.0 (copyleft) +- ⚠️ Plus lourd (~4GB VRAM) + +#### Solution Alternative +`speaches.ai` - projet qui continue le développement + +--- + +## Recommandations + +### Pour Usage Personnel (Actuel) +**Garder openedai-speech** car: +- Fonctionne actuellement +- Voice cloning français possible +- Ne nécessite pas de changement + +### Pour Amélioration Future +**Surveiller dans l'ordre:** +1. **Voxtral TTS** - Meilleure qualité française si: + - vLLM supporte la quantization (Q4/Q8) + - Ou si vous pouvez dédicacer 16GB VRAM + +2. **Kokoro-FastAPI** - Si: + - Qualité française de `ff_swis` suffit + - Vous voulez une solution légère et active + - Voice mixing suffit (pas besoin de cloning) + +--- + +## Notes Techniques + +### VRAM GPU (RX 7800 XT 16GB) +- Modèle qwen3.5:latest (Q4_K_M): ~2.5GB +- Voxtral BF16: ~16GB (pile à la limite) +- Kokoro: ~2-4GB +- openedai-speech (XTTS): ~4GB + +### Conflicts Potentiels +- `OLLAMA_KEEP_ALIVE=0` pourrait entrer en conflit avec vLLM-Omni +- Tester avant déploiement en production + +--- + +## Sources +- [Voxtral TTS - Hugging Face](https://huggingface.co/mistralai/Voxtral-4B-TTS-2603) +- [vLLM-Omni](https://github.com/vllm-project/vllm-omni) +- [Kokoro-FastAPI](https://github.com/remsky/Kokoro-FastAPI) +- [Kokoro Model](https://huggingface.co/hexgrad/Kokoro-82M) +- [Openedai-Speech](https://github.com/matatonic/openedai-speech) (archived) +- [TTS Arena Rankings](https://huggingface.co/spaces/TTS-AGI/TTS-Arena) + +--- + +*Document créé: Avril 2026* +*Dernière mise à jour: Avril 2026* diff --git a/docs/gpu/README.md b/docs/gpu/README.md new file mode 100644 index 0000000..0f4878b --- /dev/null +++ b/docs/gpu/README.md @@ -0,0 +1,23 @@ +# GPU Documentation + +## Fichiers +- [Optimization](optimization.md) - Optimisation VRAM et Ollama + +## Résumé + +### RX 7800 XT 16GB - Configuration +| Paramètre | Valeur | +|-----------|--------| +| VRAM Totale | 16GB | +| OLLAMA_KEEP_ALIVE | 0 | +| qwen3.5:latest (Q4_K_M) | ~2.5GB | + +### Optimisations Appliquées +- [x] OLLAMA_KEEP_ALIVE=0 +- [x] Service Ollama redémarré +- [x] WoL Proxy timeout réduit +- [ ] Monitoring Beszel+Dozzle + +--- + +*Dernière mise à jour: Avril 2026* diff --git a/docs/gpu/optimization.md b/docs/gpu/optimization.md new file mode 100644 index 0000000..6a5f783 --- /dev/null +++ b/docs/gpu/optimization.md @@ -0,0 +1,180 @@ +# 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 + +# 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*