From 602a9055e24d76a1c7bafd4147aa356c9d9c12b2 Mon Sep 17 00:00:00 2001 From: Ladebeze66 Date: Mon, 24 Mar 2025 22:19:57 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20rapide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .obsidian/graph.json | 4 +- .obsidian/workspace.json | 500 +++++++++++++++--- ...ts pour LLM locaux avec Cursor et Ollama.md | 2 - .../Infrastructure Optimisée d'IA Locale.md | 18 +- Serveur perso/Installation LLM dans Cursor.md | 150 ++++++ Serveur perso/LLM Cursor.md | 1 + .../automatiser-lancement-serveur-windows.md | 1 - command_list/Commandes Nvidia.md | 11 + inbox/Installation LLM +++.md | 172 ++++++ 9 files changed, 760 insertions(+), 99 deletions(-) create mode 100644 Serveur perso/Installation LLM dans Cursor.md create mode 100644 command_list/Commandes Nvidia.md create mode 100644 inbox/Installation LLM +++.md diff --git a/.obsidian/graph.json b/.obsidian/graph.json index e5de4cd..f23a198 100644 --- a/.obsidian/graph.json +++ b/.obsidian/graph.json @@ -1,6 +1,6 @@ { "collapse-filter": false, - "search": "", + "search": "path:\"Serveur perso\" ", "showTags": false, "showAttachments": false, "hideUnresolved": false, @@ -60,6 +60,6 @@ "repelStrength": 10, "linkStrength": 1, "linkDistance": 250, - "scale": 0.5087618855792638, + "scale": 1.4019828977761164, "close": true } \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 24a3228..9df1234 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -4,38 +4,367 @@ "type": "split", "children": [ { - "id": "d991961c29ad106d", + "id": "c2f4a1753293419f", "type": "tabs", "children": [ { - "id": "8cd31f588ec21296", + "id": "68491419da144553", "type": "leaf", "state": { "type": "markdown", "state": { - "file": "command_list/Ollama commands.md", - "mode": "source", + "file": "Obsidian/Ouvrir un terminal dans Obsidian.md", + "mode": "preview", "source": false }, "icon": "lucide-file", - "title": "Ollama commands" + "title": "Ouvrir un terminal dans Obsidian" } }, { - "id": "97ca7aff179659c4", + "id": "6190bc947aeac61d", "type": "leaf", "state": { "type": "markdown", "state": { - "file": "webdev/ROBO_MAT_Code_WLangage_Organise.md", + "file": "ollama/guide_ollama_complet.md", "mode": "source", "source": false }, "icon": "lucide-file", - "title": "ROBO_MAT_Code_WLangage_Organise" + "title": "guide_ollama_complet" + } + }, + { + "id": "4a79ae9b5cf40685", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Infrastructure Optimisée d'IA Locale.md", + "mode": "preview", + "source": false + }, + "icon": "lucide-file", + "title": "Infrastructure Optimisée d'IA Locale" + } + }, + { + "id": "c732e844eb2b7094", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Infrastructure Optimisée d'IA Locale (version 2).md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Infrastructure Optimisée d'IA Locale (version 2)" + } + }, + { + "id": "c425e145aee8cd6a", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Agent LLM Classes recherches 1.md", + "mode": "preview", + "source": false + }, + "icon": "lucide-file", + "title": "Agent LLM Classes recherches 1" + } + }, + { + "id": "9f01b54131d8ad11", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Agent LLM Classes recherches 1.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Agent LLM Classes recherches 1" + } + }, + { + "id": "b9670384c5347fe5", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/LLM Obsidian.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "LLM Obsidian" + } + }, + { + "id": "3d7bf6b1be159bbe", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/LLM Cursor.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "LLM Cursor" + } + }, + { + "id": "93feebe5d77bd0dc", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "ollama/Plan d'apprentissage détaillé sur Ollama.md", + "mode": "preview", + "source": false + }, + "icon": "lucide-file", + "title": "Plan d'apprentissage détaillé sur Ollama" + } + }, + { + "id": "aab7b92f101ead65", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "inbox/StramDeck config.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "StramDeck config" + } + }, + { + "id": "bf4f5ca51a0e0dd8", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Optimisation bios serveur.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Optimisation bios serveur" + } + }, + { + "id": "2bc8a1b7fd6d9af5", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Infrastructure Optimisée d'IA Locale.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Infrastructure Optimisée d'IA Locale" + } + }, + { + "id": "a152b360c324fb6f", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/LLM Cursor version2.md", + "mode": "preview", + "source": false + }, + "icon": "lucide-file", + "title": "LLM Cursor version2" + } + }, + { + "id": "1da03f7485bb0fef", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Recherche modèles.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Recherche modèles" + } + }, + { + "id": "a3ac048cd068ef21", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "inbox/Installation LLM +++.md", + "mode": "preview", + "source": false + }, + "icon": "lucide-file", + "title": "Installation LLM +++" + } + }, + { + "id": "15f320992faf0688", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Jour 5 notes support traitement ticket dev.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Jour 5 notes support traitement ticket dev" + } + }, + { + "id": "b3459535494873e5", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Obsidian/Obsidian CSS.md", + "mode": "preview", + "source": false + }, + "icon": "lucide-file", + "title": "Obsidian CSS" + } + }, + { + "id": "72aa54670d29b111", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "inbox/prompt.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "prompt" + } + }, + { + "id": "0e580d10b27a161e", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "inbox/prompt.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "prompt" + } + }, + { + "id": "5afdc6cb3fe20644", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Préversion IA locales personnelle.md", + "mode": "preview", + "source": false + }, + "icon": "lucide-file", + "title": "Préversion IA locales personnelle" + } + }, + { + "id": "4e69fedfd0d21df9", + "type": "leaf", + "state": { + "type": "graph", + "state": {}, + "icon": "lucide-git-fork", + "title": "Vue graphique" + } + }, + { + "id": "48842f66b7e7e365", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Obsidian/Liens dans obsidian.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Liens dans obsidian" + } + }, + { + "id": "64922fb286281777", + "type": "leaf", + "state": { + "type": "graph", + "state": {}, + "icon": "lucide-git-fork", + "title": "Vue graphique" + } + }, + { + "id": "4102dd91ee7179ea", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "inbox/Piste d'améliorations du projet IA locale.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Piste d'améliorations du projet IA locale" + } + }, + { + "id": "ff79cd1085f74b83", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Serveur perso/Création de classes agents pour LLM locaux avec Cursor et Ollama.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Création de classes agents pour LLM locaux avec Cursor et Ollama" + } + }, + { + "id": "6d3c8a826a68010d", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Obsidian/Ouvrir un terminal dans Obsidian.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Ouvrir un terminal dans Obsidian" } } - ] + ], + "currentTab": 14 } ], "direction": "vertical" @@ -92,7 +421,7 @@ } ], "direction": "horizontal", - "width": 300 + "width": 200 }, "right": { "id": "ad0ed0087b43302d", @@ -168,8 +497,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -178,8 +507,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -188,8 +517,8 @@ "state": { "type": "side-panel-control-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "viewIcon", + "title": "Markdown-Autocomplete" } }, { @@ -198,8 +527,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -208,8 +537,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -218,8 +547,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -228,8 +557,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -238,8 +567,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -248,8 +577,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -258,8 +587,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -268,8 +597,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -278,8 +607,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -288,8 +617,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -298,8 +627,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -308,8 +637,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -318,8 +647,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -328,8 +657,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -338,8 +667,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -348,8 +677,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } }, { @@ -358,8 +687,8 @@ "state": { "type": "SC-custom-variables-view", "state": {}, - "icon": "lucide-file", - "title": "Le module complémentaire n'est plus actif." + "icon": "code-glyph", + "title": "Shell commands: Custom variables" } } ], @@ -373,55 +702,56 @@ "left-ribbon": { "hiddenItems": { "workspaces:Gérer les espaces de travail": false, + "table-editor-obsidian:Advanced Tables Toolbar": false, + "obsidian-markdown-formatting-assistant-plugin:Open Markdown Formatting Assistant": false, "switcher:Ouvrir le sélecteur rapide": false, "graph:Ouvrir la vue graphique": false, "canvas:Créer une nouvelle toile": false, "daily-notes:Ouvrir la note quotidienne": false, "templates:Insérer le modèle": false, "command-palette:Ouvrir la palette de commandes": false, - "table-editor-obsidian:Advanced Tables Toolbar": false, - "obsidian-markdown-formatting-assistant-plugin:Open Markdown Formatting Assistant": false, "obsidian-shellcommands:Shell commands: Custom variables": false, "templater-obsidian:Templater": false } }, - "active": "8cd31f588ec21296", + "active": "a3ac048cd068ef21", "lastOpenFiles": [ - "webdev/ROBO_MAT_Analyse_clsMistral.md", - "webdev/ROBO_MAT_Analyse_clsOllama.md", - "webdev/Non confirmé 702528.crdownload", - "webdev/ROBO_MAT_Analyse_Fonctionnelle.md", - "webdev/Rappel de certaines notions WLangage et Classes.md", - "inbox/Non confirmé 367059.crdownload", - "webdev/ROBO_MAT_Code_WLangage_Organise.md", + "Serveur perso/Recherche modèles.md", + "inbox/Installation LLM +++.md", + "Serveur perso/Installation LLM dans Cursor.md", + "Serveur perso/LLM Cursor.md", + "Serveur perso/LLM Cursor version2.md", + "command_list/Ollama commands.md", + "Serveur perso/Infrastructure Optimisée d'IA Locale.md", + "Serveur perso/Création de classes agents pour LLM locaux avec Cursor et Ollama.md", + "Serveur perso/automatiser-lancement-serveur-windows.md", + "Serveur perso/Agent LLM recherches 2.md", + "Serveur perso/Agent LLM Classes recherches 1.md", + "ollama/Plan d'apprentissage détaillé sur Ollama.md", + "ollama/guide_ollama_complet.md", + "command_list/Commandes Nvidia.md", + "Serveur perso/LLM Obsidian.md", + "Serveur perso/Préversion IA locales personnelle.md", + "Serveur perso/Infrastructure Optimisée d'IA Locale (version 2).md", + "Serveur perso/Piste d'améliorations du projet IA locale.md", + "inbox/wild.md", "webdev/PJ/wlangage_class_code.json", - "webdev/Analyse_ROBO_MAT_Complete.md", - "inbox/prompt.md", - "inbox/Odoo.md", - "inbox/Notes RAGFLOW.md", - "inbox/Notes projet LLM.md", - "inbox/Node.js.md", - "inbox/Fichier type json récupération odoo.md", - "inbox/Arborescence du programme.md", - "command_list/Git commands.md", - "inbox/StramDeck config.md", - "inbox/Scripts requêtes Odoo.md", - "inbox/ROBO_MAT_Code_WLangage_Organise.json", - "inbox/Non confirmé 873082.crdownload", - "inbox/ROBO_MAT_Analyse_clsDeepl.md", - "inbox/Non confirmé 727828.crdownload", - "inbox/version épuée.md", - "inbox/Sans titre.md", - "webdev/ROBO_MAT_Analyse_Page_TEST_et_LLM.md", - "inbox/Non confirmé 465885.crdownload", + "webdev/PJ/structure_projet_robo_mat.txt", "webdev/structure_projet_robo_mat.md", + "webdev/ROBO_MAT_Code_WLangage_Organise.md", + "webdev/ROBO_MAT_Analyse_Page_TEST_et_LLM.md", + "webdev/Rappel de certaines notions WLangage et Classes.md", + "webdev/ROBO_MAT_Analyse_Fonctionnelle.md", + "webdev/PJ", + "webdev/Analyse_ROBO_MAT_Complete.md", "webdev/Application webdev (1).md", - "inbox/Non confirmé 948241.crdownload", - "inbox/Non confirmé 34515.crdownload", - "inbox/Non confirmé 822614.crdownload", - "inbox/ROBO_MAT_Analyse_Adaptation.md", - "webdev/00_Template_Analyse_ROBO_MAT.md", - "webdev/01_WLangage_Récupération_Projet_WebDev.md", + "webdev", + "inbox/ROBO_MAT_Code_WLangage_Organise.json", + "Streamdeck", + "command_list", + "Stage", + "ollama", + "Obsidian", "captures/signature.png", "captures/Capture d'écran 2025-03-20 150304.png", "captures/Capture d'écran 2025-03-20 150213.png", diff --git a/Serveur perso/Création de classes agents pour LLM locaux avec Cursor et Ollama.md b/Serveur perso/Création de classes agents pour LLM locaux avec Cursor et Ollama.md index f527e08..498cd14 100644 --- a/Serveur perso/Création de classes agents pour LLM locaux avec Cursor et Ollama.md +++ b/Serveur perso/Création de classes agents pour LLM locaux avec Cursor et Ollama.md @@ -149,5 +149,3 @@ print(code_agent.respond("def addition(a, b): return a + b")) - Base solide pour agents orchestrables. --- - -Souhaites-tu que je t’aide à créer un routeur ou une interface CLI/Streamlit pour tester ça en live ? diff --git a/Serveur perso/Infrastructure Optimisée d'IA Locale.md b/Serveur perso/Infrastructure Optimisée d'IA Locale.md index 8519c81..6575a1c 100644 --- a/Serveur perso/Infrastructure Optimisée d'IA Locale.md +++ b/Serveur perso/Infrastructure Optimisée d'IA Locale.md @@ -91,15 +91,15 @@ ollama stop ## Tableau des commandes Nvidia détaillées -|Commande|Description| -|---|---| -|`nvidia-smi`|Affiche usage GPU actuel, mémoire, température.| -|`nvidia-smi -l 1`|Rafraîchissement toutes les secondes| -|`nvidia-smi -q`|Rapport complet GPU| -|`nvidia-smi topo -m`|Topologie GPU (multi-GPU)| -|`nvcc --version`|Version CUDA installée| -|`watch -n 1 nvidia-smi`|Suivi temps réel GPU (Linux/WSL)| -|`nvitop`|Surveillance interactive temps réel (GPU)| +| Commande | Description | +| ----------------------- | ----------------------------------------------- | +| `nvidia-smi` | Affiche usage GPU actuel, mémoire, température. | +| `nvidia-smi -l 1` | Rafraîchissement toutes les secondes | +| `nvidia-smi -q` | Rapport complet GPU | +| `nvidia-smi topo -m` | Topologie GPU (multi-GPU) | +| `nvcc --version` | Version CUDA installée | +| `watch -n 1 nvidia-smi` | Suivi temps réel GPU (Linux/WSL) | +| `nvitop` | Surveillance interactive temps réel (GPU) | --- diff --git a/Serveur perso/Installation LLM dans Cursor.md b/Serveur perso/Installation LLM dans Cursor.md new file mode 100644 index 0000000..c5bc9be --- /dev/null +++ b/Serveur perso/Installation LLM dans Cursor.md @@ -0,0 +1,150 @@ +# 🎯 Tutoriel : Intégrer `codellama:13b-python` dans Cursor avec la Sidebar + Cline + +Ce guide complet t’explique comment : + +- Intégrer le modèle **codellama:13b-python** local (via **Ollama**) dans Cursor +- L’utiliser dans la **sidebar des agents + Ask** de Cursor +- Configurer **Cline** pour tirer le meilleur de ton modèle local + +--- + +## ✅ Prérequis + +- ✅ Ollama est installé et configuré +- ✅ Modèle téléchargé : `ollama pull codellama:13b-python` +- ✅ Variable `OLLAMA_MODELS` correctement configurée si besoin +- ✅ Cursor est installé ([https://cursor.so](https://cursor.so/)) + +--- + +## 🧱 Étape 1 : Vérifier que le modèle fonctionne + +Dans ton terminal : + +```bash +ollama run codellama:13b-python +``` + +> Tu dois pouvoir chatter avec le modèle en ligne de commande. + +--- + +## 🛠️ Étape 2 : Configurer `cursor-agent.json` + +1. À la racine de ton projet, crée un fichier : + +```bash +cursor-agent.json +``` + +2. Mets-y ceci : + +```json +{ + "name": "CodeLlama Local", + "entry": "main.py", + "llm": { + "provider": "custom", + "completion_url": "http://localhost:11434/api/generate", + "method": "POST", + "headers": { + "Content-Type": "application/json" + }, + "input_key": "prompt", + "output_key": "response" + } +} +``` + +--- + +## 🧠 Étape 3 : Créer un script Python minimal `main.py` + +```python +import sys +import json +import requests + +prompt = sys.stdin.read().strip() + +payload = { + "model": "codellama:13b-python", + "prompt": prompt, + "stream": False +} + +res = requests.post("http://localhost:11434/api/generate", json=payload) +print(json.dumps({"response": res.json().get("response", "")})) +``` + +✅ Ce script lit un prompt depuis Cursor, interroge Ollama, et retourne la réponse. + +--- + +## 🧪 Étape 4 : Vérifier que Cursor reconnaît le modèle + +- Ouvre Cursor +- Clique sur la **sidebar des agents (Ask)** à gauche +- Tu devrais voir **CodeLlama Local** dans la liste +- Clique dessus et tape une commande (ex : `Peux-tu générer une fonction en Python ?`) + +✅ Si tout est bien configuré, tu verras la réponse de `codellama` s’afficher. + +--- + +## 💬 Étape 5 : Utiliser le modèle avec **Cline** + +### 🔹 Qu’est-ce que Cline ? + +Cline est la barre latérale à droite de Cursor qui te permet de : + +- Sélectionner un modèle +- Voir l’historique des prompts +- Travailler sur une sélection de code + +### 📌 Utilisation : + +1. Sélectionne du code dans un fichier Python +2. Tape `//` pour activer le prompt intégré +3. Cursor ouvrira automatiquement **Cline** +4. Clique sur la flèche déroulante à côté de "Model" et choisis **CodeLlama Local** + +### ✅ Astuces : + +- Tu peux taper des prompts personnalisés du style : + + - "Optimise ce code." + - "Corrige les erreurs." + - "Ajoute un docstring." +- Les suggestions s’appliqueront directement sur le code sélectionné + + +--- + +## 🔧 Étape 6 : Personnaliser encore plus avec des agents dynamiques + +Tu peux relier `main.py` à ta propre classe Python d’agent (voir tutoriels précédents) pour : + +- Définir un rôle spécifique à chaque agent +- Créer une interface CLI +- Injecter des prompts système + +--- + +## 🧹 Étape 7 : Résolution de problèmes + +- Si `CodeLlama Local` n’apparaît pas : redémarre Cursor ou vérifie que tu es dans le bon dossier +- Si rien ne s'affiche : assure-toi que le service Ollama tourne (tester avec `ollama run`) +- Pour voir les erreurs de Cursor : `Ctrl+Shift+I` > Console + +--- + +## ✅ Tu es prêt ! + +Tu peux maintenant : + +- Utiliser ton modèle local dans la **sidebar Ask** de Cursor +- Poser des questions directement dans le **cline** à droite +- Interagir avec `codellama:13b-python` sans dépendre de l’API OpenAI ou d’internet + +Souhaites-tu maintenant que je te génère des variantes avec rôles dynamiques par agent ou une intégration CLI/Streamlit ? \ No newline at end of file diff --git a/Serveur perso/LLM Cursor.md b/Serveur perso/LLM Cursor.md index 08d4890..7514d68 100644 --- a/Serveur perso/LLM Cursor.md +++ b/Serveur perso/LLM Cursor.md @@ -15,6 +15,7 @@ - Avoir installé **Cursor** : [https://cursor.so](https://cursor.so/) - Avoir installé **Ollama** : [[https://ollama.com](https://ollama.com/)) - Avoir Python 3.10+ installé +[[Installation LLM dans Cursor]] ### Installer un modèle avec Ollama : diff --git a/Serveur perso/automatiser-lancement-serveur-windows.md b/Serveur perso/automatiser-lancement-serveur-windows.md index c31f9cb..fddaf38 100644 --- a/Serveur perso/automatiser-lancement-serveur-windows.md +++ b/Serveur perso/automatiser-lancement-serveur-windows.md @@ -122,4 +122,3 @@ PM2 permet de : --- -> ✉️ Besoin : export `.ps1` prêt à l’emploi ou `.xml` du planificateur ? Demande-moi ! diff --git a/command_list/Commandes Nvidia.md b/command_list/Commandes Nvidia.md new file mode 100644 index 0000000..50a1a08 --- /dev/null +++ b/command_list/Commandes Nvidia.md @@ -0,0 +1,11 @@ +## Tableau des commandes Nvidia détaillées + +| Commande | Description | +| ----------------------- | ----------------------------------------------- | +| `nvidia-smi` | Affiche usage GPU actuel, mémoire, température. | +| `nvidia-smi -l 1` | Rafraîchissement toutes les secondes | +| `nvidia-smi -q` | Rapport complet GPU | +| `nvidia-smi topo -m` | Topologie GPU (multi-GPU) | +| `nvcc --version` | Version CUDA installée | +| `watch -n 1 nvidia-smi` | Suivi temps réel GPU (Linux/WSL) | +| `nvitop` | Surveillance interactive temps réel (GPU) | diff --git a/inbox/Installation LLM +++.md b/inbox/Installation LLM +++.md new file mode 100644 index 0000000..492c4a2 --- /dev/null +++ b/inbox/Installation LLM +++.md @@ -0,0 +1,172 @@ + +--- +# 🎯 Tutoriel : Intégrer `codellama:13b-python` dans Cursor avec Cline — Version Optimisée et Ergonomique + +Ce guide te montre **la méthode la plus simple et efficace** pour exploiter tes modèles locaux `codellama:13b-python` (pour Cursor) et `llama2:13b` (pour Obsidian) via **Cline**, tout en te donnant la capacité de gérer plusieurs LLM, de modifier dynamiquement leurs paramètres, et de créer plusieurs agents spécialisés. + +--- + +## ✅ Objectif + +- Utiliser tes modèles locaux via **Cline**, l'interface latérale intelligente de Cursor +- Passer rapidement d’un modèle à un autre (`codellama` pour Cursor, `llama2:13b` pour Obsidian) +- Gérer facilement le contexte, les rôles dynamiques et les paramètres personnalisés de chaque modèle +- Centraliser les fichiers de configuration et les réutiliser dans tous tes projets Cursor ou Obsidian + +--- + +## 🧱 Étape 1 : Préparer les modèles avec Ollama + +### Télécharger les modèles que tu veux utiliser : + +```bash +ollama pull codellama:13b-python # Pour Cursor (code) +ollama pull llama2:13b # Pour Obsidian (généraliste structuré) +``` + +✅ Vérifie qu’ils sont bien installés : + +```bash +ollama list +``` + +--- + +## 📁 Étape 2 : Organisation centrale des fichiers + +Plutôt que de recopier à chaque fois, crée un dossier centralisé : + +``` +~/cursor-llm-config/ +├── cursor-agent.json +├── main.py +├── config.json # Gère les paramètres dynamiques des modèles +├── agents/ +│ ├── optimizer.py +│ ├── refactor.py +│ └── docstringer.py +``` + +> 💡 Ce dossier peut être placé dans un emplacement accessible depuis WSL ET Windows si tu utilises Cursor sous Windows (ex: `/mnt/c/Users/tonprofil/llm-config`) pour unifier l'accès. + +--- + +## ⚙️ Étape 3 : Fichier `cursor-agent.json` + +```json +{ + "name": "LLM Local Agent", + "entry": "main.py", + "llm": { + "provider": "custom", + "completion_url": "http://localhost:11434/api/generate", + "method": "POST", + "headers": { "Content-Type": "application/json" }, + "input_key": "prompt", + "output_key": "response" + } +} +``` + +--- + +## 🧠 Étape 4 : Script `main.py` configurable + +```python +import sys +import json +import requests +import os + +with open("config.json", "r") as f: + config = json.load(f) + +model = config.get("model", "codellama:13b-python") +prompt = sys.stdin.read().strip() + +payload = { + "model": model, + "prompt": prompt, + "temperature": config.get("temperature", 0.7), + "top_p": config.get("top_p", 0.9), + "num_predict": config.get("num_predict", 2048), + "stream": False +} + +res = requests.post("http://localhost:11434/api/generate", json=payload) +print(json.dumps({"response": res.json().get("response", "")})) +``` + +--- + +## 🧩 Étape 5 : Fichier `config.json` pour personnaliser les paramètres + +```json +{ + "model": "codellama:13b-python", + "temperature": 0.7, + "top_p": 0.9, + "num_predict": 2048 +} +``` + +> 🔄 Pour Obsidian, change simplement `"model"` en `"llama2:13b"`. + +--- + +## 🧬 Étape 6 : Utiliser Cline efficacement + +1. Ouvre Cursor et sélectionne du code +2. Tape `//` ou clic droit > "Ask..." +3. Dans la barre Cline : + - Sélectionne le modèle : `LLM Local Agent` + - Ajoute un prompt (ex : "Optimise cette fonction") + +Tu peux combiner prompt utilisateur + système pour obtenir des réponses sur mesure. + +--- + +## 🧠 Étape 7 : Créer plusieurs agents spécialisés (optionnel mais recommandé) + +Crée un dossier `agents/` avec des fichiers comme : + +- `optimizer.py` → Optimisation de fonctions +- `refactor.py` → Refactorisation +- `docstringer.py` → Génération de docstrings + +Chacun peut être appelé depuis un wrapper CLI ou une extension Cursor avancée. + +--- + +## 💡 Étape 8 : Configuration pour Obsidian + +- Le modèle `llama2:13b` est recommandé pour ses capacités de résumé, classification, mise en forme, et structuration de notes. +- Tu peux utiliser le même `main.py` et `config.json`, en modifiant simplement le modèle. +- Pour automatiser avec Obsidian (via un plugin ou script externe), tu peux lancer une requête vers `http://localhost:11434/api/generate` avec un prompt construit dynamiquement depuis le contenu d’une note Markdown. + +--- + +## 🚀 Astuce : Script CLI de sélection + +Crée un script CLI qui te permet de modifier `config.json` à la volée : + +```bash +python switch_model.py --model llama2:13b --temperature 0.6 +``` + +Et dans `switch_model.py`, édite dynamiquement le fichier `config.json`. + +--- + +## ✅ Résumé + +|Étape|Action clé| +|---|---| +|1. Ollama|Télécharger `codellama:13b-python` + `llama2:13b`| +|2. Structure|Centraliser `main.py`, `config.json`, `cursor-agent.json`| +|3. Cline|Utiliser ton modèle local depuis l'interface| +|4. Paramètres|Modifier facilement température, top_p, nombre de tokens| +|5. Agents|Créer des agents spécialisés pour chaque type de tâche| +|6. Obsidian|Utiliser `llama2:13b` pour améliorer, structurer et relier les notes| + +---