Update README.md
Browse files
README.md
CHANGED
|
@@ -1,290 +1,261 @@
|
|
| 1 |
---
|
| 2 |
-
base_model: unsloth/Llama-3.2-3B-Instruct-bnb-4bit
|
| 3 |
tags:
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
license: apache-2.0
|
| 11 |
language:
|
| 12 |
-
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
-
#
|
| 16 |
|
| 17 |
-
**Developed by:** dereklck
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
- **Politely requesting additional information** when the instruction is incomplete or ambiguous.
|
| 40 |
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
- **Developers Working with Kubernetes Clusters**
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
| 50 |
-
- **
|
| 51 |
-
-
|
|
|
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
- **Example:**
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
| 71 |
-
- **Example:**
|
| 72 |
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
|
| 75 |
-
|
| 76 |
|
| 77 |
-
|
| 78 |
|
| 79 |
-
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
|
|
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
| 87 |
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
|
| 91 |
|
| 92 |
-
|
| 93 |
-
- **Example:**
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
| 98 |
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
|
| 101 |
-
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
The model uses the following prompt template to generate responses:
|
| 108 |
|
| 109 |
```plaintext
|
| 110 |
You are an AI assistant that helps users with Kubernetes commands and questions.
|
| 111 |
|
| 112 |
-
**Guidelines:**
|
| 113 |
|
| 114 |
-
1. **For clear instructions:**
|
| 115 |
-
- Provide
|
| 116 |
-
- Do
|
| 117 |
-
- Enclose the command within a code block
|
| 118 |
|
| 119 |
2. **For incomplete or ambiguous instructions:**
|
| 120 |
-
- **Politely ask** the user for specific missing information.
|
| 121 |
-
- Do **not** provide any commands or placeholders.
|
| 122 |
- Respond in plain text, clearly stating what information is needed.
|
| 123 |
|
| 124 |
3. **For general Kubernetes questions:**
|
| 125 |
- Provide a **concise and accurate explanation**.
|
| 126 |
- Do **not** include any commands unless specifically requested.
|
|
|
|
| 127 |
|
| 128 |
**Important Rules:**
|
| 129 |
|
| 130 |
-
- Do
|
| 131 |
-
- Ensure all commands are
|
| 132 |
-
- If
|
| 133 |
-
-
|
| 134 |
-
|
| 135 |
-
---
|
| 136 |
|
| 137 |
### Instruction:
|
| 138 |
{instruction}
|
| 139 |
|
| 140 |
### Response:
|
|
|
|
| 141 |
```
|
| 142 |
|
| 143 |
-
###
|
| 144 |
|
| 145 |
-
- **Temperature:** `0.3` (
|
| 146 |
-
- **Stop Token:** `</s>` (
|
| 147 |
|
| 148 |
---
|
| 149 |
|
| 150 |
-
##
|
| 151 |
-
|
| 152 |
-
### **Enhanced Understanding**
|
| 153 |
-
|
| 154 |
-
With **3 billion parameters**, this model provides:
|
| 155 |
|
| 156 |
-
|
| 157 |
-
- **Better handling of edge cases** and less common Kubernetes operations.
|
| 158 |
|
| 159 |
-
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
### **Examples of Reactions to Questions**
|
| 165 |
-
|
| 166 |
-
#### **📗 Generating Complex Commands**
|
| 167 |
-
|
| 168 |
-
**User:** "Scale deployment 'backend-service' to 5 replicas."
|
| 169 |
|
| 170 |
-
**
|
| 171 |
|
| 172 |
```bash
|
| 173 |
-
kubectl
|
| 174 |
```
|
| 175 |
|
| 176 |
-
#### **❓ Handling Ambiguity**
|
| 177 |
-
|
| 178 |
-
**User:** "Delete the resource."
|
| 179 |
-
|
| 180 |
-
**Model Response:**
|
| 181 |
-
|
| 182 |
-
"Please specify the type and name of the resource you wish to delete."
|
| 183 |
-
|
| 184 |
-
#### **🧠 Explaining Concepts**
|
| 185 |
-
|
| 186 |
-
**User:** "Explain how Kubernetes handles Secrets."
|
| 187 |
-
|
| 188 |
-
**Model Response:**
|
| 189 |
-
|
| 190 |
-
"Kubernetes Secrets allow you to store and manage sensitive information, such as passwords and tokens, in a secure manner. They can be mounted as files or exposed as environment variables in pods."
|
| 191 |
-
|
| 192 |
-
#### **🛑 Addressing Inappropriate Language**
|
| 193 |
-
|
| 194 |
-
**User:** "What the heck is wrong with this cluster?"
|
| 195 |
-
|
| 196 |
-
**Model Response:**
|
| 197 |
-
|
| 198 |
-
"Could you please provide more details about the issue you're experiencing with your cluster?"
|
| 199 |
-
|
| 200 |
-
---
|
| 201 |
-
|
| 202 |
-
## **🚀 Deployment with Ollama**
|
| 203 |
-
|
| 204 |
-
### **Prerequisites**
|
| 205 |
-
|
| 206 |
-
- Install [Ollama](https://github.com/jmorganca/ollama) on your system.
|
| 207 |
-
- Download the GGUF model directly from Hugging Face:
|
| 208 |
-
|
| 209 |
-
```bash
|
| 210 |
-
ollama pull hf.co/dereklck/kubectl_operator_3b_peft_gguf
|
| 211 |
-
```
|
| 212 |
-
|
| 213 |
-
### **Steps to Use the Model**
|
| 214 |
-
|
| 215 |
-
1. **Run the Model**
|
| 216 |
-
|
| 217 |
-
```bash
|
| 218 |
-
ollama run dereklck/kubectl_operator_3b_peft_gguf
|
| 219 |
-
```
|
| 220 |
-
|
| 221 |
-
2. **Interact with the Model**
|
| 222 |
-
|
| 223 |
-
Provide your instruction when prompted by the model.
|
| 224 |
-
|
| 225 |
---
|
| 226 |
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
### **Accuracy**
|
| 230 |
-
|
| 231 |
-
- While the model aims to generate precise commands, always **review the output** before execution to ensure it's appropriate for your environment.
|
| 232 |
|
| 233 |
-
|
| 234 |
|
| 235 |
-
|
|
|
|
|
|
|
| 236 |
|
| 237 |
-
|
| 238 |
|
| 239 |
-
|
|
|
|
|
|
|
| 240 |
|
| 241 |
---
|
| 242 |
|
| 243 |
-
|
| 244 |
|
| 245 |
-
|
| 246 |
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
---
|
| 251 |
|
| 252 |
-
|
| 253 |
|
| 254 |
-
|
|
|
|
|
|
|
| 255 |
|
| 256 |
---
|
| 257 |
|
| 258 |
-
##
|
| 259 |
|
| 260 |
-
|
|
|
|
|
|
|
| 261 |
|
| 262 |
---
|
| 263 |
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
---
|
| 267 |
|
| 268 |
-
|
| 269 |
|
| 270 |
-
- **
|
| 271 |
-
- **
|
| 272 |
-
- **Use horizontal rules (`***` or `___`) or headings to separate sections instead of `---`.**
|
| 273 |
|
| 274 |
---
|
| 275 |
|
| 276 |
-
**
|
| 277 |
-
|
| 278 |
-
```yaml
|
| 279 |
-
base_model: unsloth/Llama-3.2-3B-Instruct-bnb-4bit
|
| 280 |
-
tags:
|
| 281 |
-
- text-generation-inference
|
| 282 |
-
- transformers
|
| 283 |
-
- unsloth
|
| 284 |
-
- llama
|
| 285 |
-
- gguf
|
| 286 |
-
- ollama
|
| 287 |
-
license: apache-2.0
|
| 288 |
-
language:
|
| 289 |
-
- en
|
| 290 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: unsloth/Llama-3.2-3B-Instruct-bnb-4bit
|
| 3 |
tags:
|
| 4 |
+
- text-generation-inference
|
| 5 |
+
- transformers
|
| 6 |
+
- unsloth
|
| 7 |
+
- llama
|
| 8 |
+
- gguf
|
| 9 |
+
- ollama
|
| 10 |
+
license: apache-2.0
|
| 11 |
language:
|
| 12 |
+
- en
|
| 13 |
+
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# kubectl Operator Model
|
| 17 |
|
| 18 |
+
- **Developed by:** dereklck
|
| 19 |
+
- **License:** Apache-2.0
|
| 20 |
+
- **Fine-tuned from model:** [unsloth/Llama-3.2-1B-Instruct-bnb-4bit](https://huggingface.co/unsloth/Llama-3.2-1B-Instruct-bnb-4bit)
|
| 21 |
+
- **Model type:** GGUF (compatible with Ollama)
|
| 22 |
+
- **Language:** English
|
| 23 |
|
| 24 |
+
This Llama-based model was fine-tuned to generate `kubectl` commands based on user descriptions. It was trained efficiently using [Unsloth](https://github.com/unslothai/unsloth) and Hugging Face's TRL library.
|
| 25 |
|
| 26 |
+
---
|
| 27 |
|
| 28 |
+
## How to Use the Model
|
| 29 |
|
| 30 |
+
This section provides instructions on how to run the model using Ollama and the provided Modelfile.
|
| 31 |
|
| 32 |
+
### Prerequisites
|
| 33 |
|
| 34 |
+
- Install [Ollama](https://github.com/jmorganca/ollama) on your system.
|
| 35 |
+
- Ensure you have access to the model hosted on Hugging Face: `hf.co/dereklck/kubernetes_operator_3b_peft_gguf`.
|
| 36 |
|
| 37 |
+
### Steps
|
| 38 |
|
| 39 |
+
1. **Create the Modelfile**
|
| 40 |
|
| 41 |
+
Save the following content as a file named `Modelfile`:
|
| 42 |
|
| 43 |
+
```plaintext
|
| 44 |
+
FROM hf.co/dereklck/kubernetes_operator_3b_peft_gguf
|
|
|
|
| 45 |
|
| 46 |
+
PARAMETER temperature 0.3
|
| 47 |
+
PARAMETER stop "</s>"
|
| 48 |
|
| 49 |
+
TEMPLATE """
|
| 50 |
+
You are an AI assistant that helps users with Kubernetes commands and questions.
|
|
|
|
| 51 |
|
| 52 |
+
**Your Behavior Guidelines:**
|
| 53 |
|
| 54 |
+
1. **For clear and complete instructions:**
|
| 55 |
+
- **Provide only** the exact `kubectl` command needed to fulfill the user's request.
|
| 56 |
+
- Do not include extra explanations, placeholders, or context.
|
| 57 |
+
- **Enclose the command within a code block** with `bash` syntax highlighting.
|
| 58 |
|
| 59 |
+
2. **For incomplete or ambiguous instructions:**
|
| 60 |
+
- **Politely ask** the user for the specific missing information.
|
| 61 |
+
- Do **not** provide any commands or placeholders in your response.
|
| 62 |
+
- Respond in plain text, clearly stating what information is needed.
|
| 63 |
|
| 64 |
+
3. **For general Kubernetes questions:**
|
| 65 |
+
- Provide a **concise and accurate explanation**.
|
| 66 |
+
- Do **not** include any commands unless specifically requested.
|
| 67 |
+
- Ensure that the explanation fully addresses the user's question.
|
| 68 |
|
| 69 |
+
**Important Rules:**
|
|
|
|
| 70 |
|
| 71 |
+
- **Do not generate CLI commands containing placeholders (e.g., <pod_name>, <resource_name>).**
|
| 72 |
+
- Ensure all CLI commands are complete, valid, and executable as provided.
|
| 73 |
+
- If user input is insufficient to form a complete command, ask for clarification instead of using placeholders.
|
| 74 |
+
- Provide only the necessary CLI command output without any additional text.
|
| 75 |
|
| 76 |
+
### Instruction:
|
| 77 |
+
{{ .Prompt }}
|
| 78 |
|
| 79 |
+
### Response:
|
| 80 |
+
{{ .Response }}
|
| 81 |
+
</s>
|
| 82 |
+
"""
|
| 83 |
+
```
|
| 84 |
|
| 85 |
+
2. **Create the Model with Ollama**
|
| 86 |
|
| 87 |
+
Open your terminal and run the following command to create the model:
|
|
|
|
| 88 |
|
| 89 |
+
```bash
|
| 90 |
+
ollama create kubernetes_operator -f Modelfile
|
| 91 |
+
```
|
| 92 |
|
| 93 |
+
This command tells Ollama to create a new model named `kubernetes_operator` using the configuration specified in `Modelfile`.
|
| 94 |
|
| 95 |
+
3. **Run the Model**
|
| 96 |
|
| 97 |
+
Start interacting with your model:
|
| 98 |
|
| 99 |
+
```bash
|
| 100 |
+
ollama run kubernetes_operator
|
| 101 |
+
```
|
| 102 |
|
| 103 |
+
This will initiate the model and prompt you for input based on the template provided.
|
| 104 |
|
| 105 |
+
Alternatively, you can provide an instruction directly:
|
| 106 |
|
| 107 |
+
```bash
|
| 108 |
+
ollama run kubernetes_operator -p "Create a namespace called 'production'."
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
**Example Output:**
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
kubectl create namespace production
|
| 115 |
+
```
|
| 116 |
|
| 117 |
+
---
|
| 118 |
|
| 119 |
+
## Model Details
|
|
|
|
| 120 |
|
| 121 |
+
### Purpose
|
| 122 |
|
| 123 |
+
The model assists users by:
|
| 124 |
|
| 125 |
+
- **Generating accurate `kubectl` commands** based on natural language descriptions.
|
| 126 |
+
- **Providing brief explanations about Kubernetes** for general queries.
|
| 127 |
+
- **Requesting additional information** if the instruction is incomplete or ambiguous.
|
| 128 |
|
| 129 |
+
### Intended Users
|
| 130 |
|
| 131 |
+
- Kubernetes administrators
|
| 132 |
+
- DevOps engineers
|
| 133 |
+
- Developers working with Kubernetes clusters
|
| 134 |
|
| 135 |
+
### Training Process
|
| 136 |
+
|
| 137 |
+
- **Base Model:** Unsloth's Llama-3.2-1B-Instruct-bnb-4bit
|
| 138 |
+
- **Fine-tuning:** Leveraged the Unsloth framework and Hugging Face's TRL library for efficient training.
|
| 139 |
+
- **Training Data:** Customized dataset focused on Kubernetes operations and `kubectl` command usage, containing approximately 200 entries.
|
| 140 |
+
|
| 141 |
+
### Features
|
| 142 |
+
|
| 143 |
+
- **Command Generation:** Translates user instructions into executable `kubectl` commands.
|
| 144 |
+
- **Clarification Requests:** Politely asks for more details when the instruction is incomplete.
|
| 145 |
+
- **Knowledge Base:** Provides concise explanations for general Kubernetes concepts.
|
| 146 |
+
|
| 147 |
+
---
|
| 148 |
+
|
| 149 |
+
## Prompt Template
|
| 150 |
|
| 151 |
The model uses the following prompt template to generate responses:
|
| 152 |
|
| 153 |
```plaintext
|
| 154 |
You are an AI assistant that helps users with Kubernetes commands and questions.
|
| 155 |
|
| 156 |
+
**Your Behavior Guidelines:**
|
| 157 |
|
| 158 |
+
1. **For clear and complete instructions:**
|
| 159 |
+
- **Provide only** the exact `kubectl` command needed to fulfill the user's request.
|
| 160 |
+
- Do not include extra explanations, placeholders, or context.
|
| 161 |
+
- **Enclose the command within a code block** with `bash` syntax highlighting.
|
| 162 |
|
| 163 |
2. **For incomplete or ambiguous instructions:**
|
| 164 |
+
- **Politely ask** the user for the specific missing information.
|
| 165 |
+
- Do **not** provide any commands or placeholders in your response.
|
| 166 |
- Respond in plain text, clearly stating what information is needed.
|
| 167 |
|
| 168 |
3. **For general Kubernetes questions:**
|
| 169 |
- Provide a **concise and accurate explanation**.
|
| 170 |
- Do **not** include any commands unless specifically requested.
|
| 171 |
+
- Ensure that the explanation fully addresses the user's question.
|
| 172 |
|
| 173 |
**Important Rules:**
|
| 174 |
|
| 175 |
+
- **Do not generate CLI commands containing placeholders (e.g., <pod_name>, <resource_name>).**
|
| 176 |
+
- Ensure all CLI commands are complete, valid, and executable as provided.
|
| 177 |
+
- If user input is insufficient to form a complete command, ask for clarification instead of using placeholders.
|
| 178 |
+
- Provide only the necessary CLI command output without any additional text.
|
|
|
|
|
|
|
| 179 |
|
| 180 |
### Instruction:
|
| 181 |
{instruction}
|
| 182 |
|
| 183 |
### Response:
|
| 184 |
+
{response}
|
| 185 |
```
|
| 186 |
|
| 187 |
+
### Parameters
|
| 188 |
|
| 189 |
+
- **Temperature:** `0.3` (controls randomness; lower values make outputs more deterministic)
|
| 190 |
+
- **Stop Token:** `</s>` (indicates the end of the assistant's response)
|
| 191 |
|
| 192 |
---
|
| 193 |
|
| 194 |
+
## Examples
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
|
| 196 |
+
### Example 1: Generating a Command
|
|
|
|
| 197 |
|
| 198 |
+
**Instruction:**
|
| 199 |
|
| 200 |
+
```
|
| 201 |
+
Create a namespace called 'development'.
|
| 202 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
+
**Response:**
|
| 205 |
|
| 206 |
```bash
|
| 207 |
+
kubectl create namespace development
|
| 208 |
```
|
| 209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
---
|
| 211 |
|
| 212 |
+
### Example 2: Handling Ambiguity
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
+
**Instruction:**
|
| 215 |
|
| 216 |
+
```
|
| 217 |
+
Show me logs.
|
| 218 |
+
```
|
| 219 |
|
| 220 |
+
**Response:**
|
| 221 |
|
| 222 |
+
```
|
| 223 |
+
Which pod's logs would you like to retrieve?
|
| 224 |
+
```
|
| 225 |
|
| 226 |
---
|
| 227 |
|
| 228 |
+
### Example 3: Providing Explanations
|
| 229 |
|
| 230 |
+
**Instruction:**
|
| 231 |
|
| 232 |
+
```
|
| 233 |
+
What is a Deployment in Kubernetes?
|
| 234 |
+
```
|
|
|
|
| 235 |
|
| 236 |
+
**Response:**
|
| 237 |
|
| 238 |
+
```
|
| 239 |
+
A Deployment provides declarative updates for Pods and ReplicaSets, allowing you to manage your applications by defining the desired state and letting Kubernetes handle the rest.
|
| 240 |
+
```
|
| 241 |
|
| 242 |
---
|
| 243 |
|
| 244 |
+
## Limitations and Considerations
|
| 245 |
|
| 246 |
+
- **Accuracy:** The model may occasionally produce incorrect or suboptimal commands. Always review the output before execution.
|
| 247 |
+
- **Hallucinations:** In rare cases, the model might generate irrelevant or incorrect information. If the response seems off-topic, consider rephrasing your instruction.
|
| 248 |
+
- **Security:** Be cautious when executing generated commands, especially in production environments.
|
| 249 |
|
| 250 |
---
|
| 251 |
|
| 252 |
+
## Feedback and Contributions
|
|
|
|
|
|
|
| 253 |
|
| 254 |
+
We welcome any comments or participation to improve the model and dataset. If you encounter issues or have suggestions for improvement:
|
| 255 |
|
| 256 |
+
- **GitHub:** [Unsloth Repository](https://github.com/unslothai/unsloth)
|
| 257 |
+
- **Contact:** Reach out to the developer, **dereklck**, for further assistance.
|
|
|
|
| 258 |
|
| 259 |
---
|
| 260 |
|
| 261 |
+
**Note:** This model provides assistance in generating `kubectl` commands based on user input. Always verify the generated commands in a safe environment before executing them in a production cluster.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|