Update README.md
Browse files
README.md
CHANGED
|
@@ -1,290 +1,241 @@
|
|
| 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 |
-
- **Providing concise explanations about Kubernetes** for general queries.
|
| 39 |
-
- **Politely requesting additional information** when the instruction is incomplete or ambiguous.
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
-
- **DevOps Engineers**
|
| 45 |
-
- **Developers Working with Kubernetes Clusters**
|
| 46 |
|
| 47 |
-
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
- **Training Data:** Customized dataset focused on Kubernetes operations and `kubectl` command usage, containing approximately **1,500 entries** for improved coverage.
|
| 52 |
|
| 53 |
-
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
|
| 57 |
-
|
| 58 |
-
- **
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
-
kubectl create namespace production
|
| 66 |
-
```
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
-
|
| 76 |
|
| 77 |
-
|
| 78 |
|
| 79 |
-
|
|
|
|
|
|
|
| 80 |
|
| 81 |
-
|
| 82 |
-
- **Example:**
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
| 87 |
|
| 88 |
-
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
|
| 91 |
|
| 92 |
-
|
| 93 |
-
- **Example:**
|
| 94 |
|
| 95 |
-
|
|
|
|
|
|
|
| 96 |
|
| 97 |
-
|
| 98 |
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
|
| 101 |
---
|
| 102 |
|
| 103 |
-
##
|
| 104 |
-
|
| 105 |
-
### **📝 Prompt Template**
|
| 106 |
-
|
| 107 |
-
The model uses the following prompt template to generate responses:
|
| 108 |
|
| 109 |
-
|
| 110 |
-
You are an AI assistant that helps users with Kubernetes commands and questions.
|
| 111 |
|
| 112 |
-
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
- Enclose the command within a code block using `bash` syntax.
|
| 118 |
|
| 119 |
-
|
| 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 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
|
| 128 |
-
|
| 129 |
|
| 130 |
-
-
|
| 131 |
-
-
|
| 132 |
-
-
|
| 133 |
-
- Do **not** add extra text beyond what's necessary.
|
| 134 |
|
| 135 |
---
|
| 136 |
|
| 137 |
-
|
| 138 |
-
{instruction}
|
| 139 |
|
| 140 |
-
###
|
| 141 |
-
```
|
| 142 |
|
| 143 |
-
|
| 144 |
|
| 145 |
-
|
| 146 |
-
- **Stop Token:** `</s>` (Indicates the end of the assistant's response.)
|
| 147 |
|
| 148 |
-
|
| 149 |
|
| 150 |
-
|
| 151 |
|
| 152 |
-
|
| 153 |
|
| 154 |
-
|
| 155 |
|
| 156 |
-
|
| 157 |
-
- **Better handling of edge cases** and less common Kubernetes operations.
|
| 158 |
|
| 159 |
-
|
| 160 |
|
| 161 |
-
|
| 162 |
-
- **Filters inappropriate language** and focuses on providing assistance.
|
| 163 |
|
| 164 |
-
###
|
| 165 |
|
| 166 |
-
|
| 167 |
|
| 168 |
-
|
|
|
|
|
|
|
| 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 |
-
|
| 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 |
-
|
| 216 |
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
|
| 221 |
-
|
| 222 |
|
| 223 |
-
|
|
|
|
|
|
|
| 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 |
-
- Be cautious when executing commands that make changes to your cluster. **Backup important data** and test commands in a safe environment when possible.
|
| 240 |
-
|
| 241 |
-
---
|
| 242 |
-
|
| 243 |
-
## **🤝 Feedback and Contributions**
|
| 244 |
|
| 245 |
-
|
| 246 |
|
| 247 |
-
|
| 248 |
-
|
|
|
|
| 249 |
|
| 250 |
---
|
| 251 |
|
| 252 |
-
##
|
| 253 |
|
| 254 |
-
|
|
|
|
| 255 |
|
| 256 |
---
|
| 257 |
|
| 258 |
-
##
|
| 259 |
-
|
| 260 |
-
The **kubectl Operator Model - 3B GGUF** offers a powerful tool for Kubernetes practitioners, providing reliable command generation and valuable explanations. Its enhanced capabilities make it a valuable asset for managing Kubernetes clusters more efficiently.
|
| 261 |
|
| 262 |
-
|
| 263 |
|
| 264 |
-
**
|
|
|
|
| 265 |
|
| 266 |
---
|
| 267 |
|
| 268 |
-
**
|
| 269 |
-
|
| 270 |
-
- **Ensure the YAML front matter at the top is properly formatted.**
|
| 271 |
-
- **Avoid including `---` within the content, as it can be misinterpreted as YAML delimiters.**
|
| 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 |
+
# Hybrid Kubernetes Feature Model
|
| 17 |
|
| 18 |
+
- **Developed by:** dereklck
|
| 19 |
+
- **License:** Apache-2.0
|
| 20 |
+
- **Fine-tuned from model:** [unsloth/Llama-3.2-3B-Instruct-bnb-4bit](https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-bnb-4bit)
|
| 21 |
+
- **Model type:** GGUF (compatible with Ollama)
|
| 22 |
+
- **Language:** English
|
| 23 |
|
| 24 |
+
This Llama-based model was fine-tuned to assist users with Kubernetes commands and questions. It has three primary features:
|
| 25 |
|
| 26 |
+
1. **Generating accurate `kubectl` commands** based on user descriptions.
|
| 27 |
+
2. **Providing concise explanations about Kubernetes** for general queries.
|
| 28 |
+
3. **Politely requesting additional information** if the instruction is incomplete or ambiguous.
|
| 29 |
|
| 30 |
+
**Update:** Compared to the previous 1B model, the **3B model significantly reduces hallucinations** that sometimes occurred in the 1B model. Users can expect improved accuracy and reliability when interacting with this model.
|
| 31 |
|
| 32 |
+
The model was trained efficiently using [Unsloth](https://github.com/unslothai/unsloth) and Hugging Face's TRL library.
|
| 33 |
|
| 34 |
---
|
| 35 |
|
| 36 |
+
## How to Use the Model
|
| 37 |
|
| 38 |
+
This section provides instructions on how to run the model using Ollama and the provided Modelfile.
|
| 39 |
|
| 40 |
+
### Prerequisites
|
| 41 |
|
| 42 |
+
- Install [Ollama](https://github.com/jmorganca/ollama) on your system.
|
| 43 |
+
- Ensure you have access to the model hosted on Hugging Face: `hf.co/dereklck/kubernetes_operator_3b_peft_gguf`.
|
| 44 |
|
| 45 |
+
### Steps
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
1. **Create the Modelfile**
|
| 48 |
|
| 49 |
+
Save the following content as a file named `Modelfile`:
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
```plaintext
|
| 52 |
+
FROM hf.co/dereklck/kubernetes_operator_3b_peft_gguf
|
| 53 |
|
| 54 |
+
PARAMETER temperature 0.3
|
| 55 |
+
PARAMETER stop "</s>"
|
|
|
|
| 56 |
|
| 57 |
+
TEMPLATE """
|
| 58 |
+
You are an AI assistant that helps users with Kubernetes commands and questions.
|
| 59 |
|
| 60 |
+
**Your Behavior Guidelines:**
|
| 61 |
|
| 62 |
+
1. **For clear and complete instructions:**
|
| 63 |
+
- **Provide only** the exact `kubectl` command needed to fulfill the user's request.
|
| 64 |
+
- Do not include extra explanations, placeholders, or context.
|
| 65 |
+
- **Enclose the command within a code block** with `bash` syntax highlighting.
|
| 66 |
|
| 67 |
+
2. **For incomplete or ambiguous instructions:**
|
| 68 |
+
- **Politely ask** the user for the specific missing information.
|
| 69 |
+
- Do **not** provide any commands or placeholders in your response.
|
| 70 |
+
- Respond in plain text, clearly stating what information is needed.
|
| 71 |
|
| 72 |
+
3. **For general Kubernetes questions:**
|
| 73 |
+
- Provide a **concise and accurate explanation**.
|
| 74 |
+
- Do **not** include any commands unless specifically requested.
|
| 75 |
+
- Ensure that the explanation fully addresses the user's question.
|
| 76 |
|
| 77 |
+
**Important Rules:**
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
- **Do not generate CLI commands containing placeholders (e.g., <pod_name>, <resource_name>).**
|
| 80 |
+
- Ensure all CLI commands are complete, valid, and executable as provided.
|
| 81 |
+
- If user input is insufficient to form a complete command, ask for clarification instead of using placeholders.
|
| 82 |
+
- Provide only the necessary CLI command output without any additional text.
|
| 83 |
|
| 84 |
+
### Instruction:
|
| 85 |
+
{{ .Prompt }}
|
| 86 |
|
| 87 |
+
### Response:
|
| 88 |
+
{{ .Response }}
|
| 89 |
+
</s>
|
| 90 |
+
"""
|
| 91 |
+
```
|
| 92 |
|
| 93 |
+
2. **Create the Model with Ollama**
|
| 94 |
|
| 95 |
+
Open your terminal and run the following command to create the model:
|
| 96 |
|
| 97 |
+
```bash
|
| 98 |
+
ollama create hybrid_kubernetes_feature_model -f Modelfile
|
| 99 |
+
```
|
| 100 |
|
| 101 |
+
This command tells Ollama to create a new model named `hybrid_kubernetes_feature_model` using the configuration specified in `Modelfile`.
|
|
|
|
| 102 |
|
| 103 |
+
3. **Run the Model**
|
| 104 |
|
| 105 |
+
Start interacting with your model:
|
| 106 |
|
| 107 |
+
```bash
|
| 108 |
+
ollama run hybrid_kubernetes_feature_model
|
| 109 |
+
```
|
| 110 |
|
| 111 |
+
This will initiate the model and prompt you for input based on the template provided.
|
| 112 |
|
| 113 |
+
Alternatively, you can provide an instruction directly:
|
|
|
|
| 114 |
|
| 115 |
+
```bash
|
| 116 |
+
ollama run hybrid_kubernetes_feature_model -p "Create a namespace called 'production'."
|
| 117 |
+
```
|
| 118 |
|
| 119 |
+
**Example Output:**
|
| 120 |
|
| 121 |
+
```bash
|
| 122 |
+
kubectl create namespace production
|
| 123 |
+
```
|
| 124 |
|
| 125 |
---
|
| 126 |
|
| 127 |
+
## Model Details
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
+
### Purpose
|
|
|
|
| 130 |
|
| 131 |
+
The model assists users by:
|
| 132 |
|
| 133 |
+
- **Generating accurate `kubectl` commands** based on natural language descriptions.
|
| 134 |
+
- **Providing concise explanations about Kubernetes** for general queries.
|
| 135 |
+
- **Politely requesting additional information** if the instruction is incomplete or ambiguous.
|
|
|
|
| 136 |
|
| 137 |
+
### Intended Users
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
+
- Kubernetes administrators
|
| 140 |
+
- DevOps engineers
|
| 141 |
+
- Developers working with Kubernetes clusters
|
| 142 |
|
| 143 |
+
### Training Process
|
| 144 |
|
| 145 |
+
- **Base Model:** Unsloth's Llama-3.2-3B-Instruct-bnb-4bit
|
| 146 |
+
- **Fine-tuning:** Leveraged the Unsloth framework and Hugging Face's TRL library for efficient training.
|
| 147 |
+
- **Training Data:** Customized dataset focused on Kubernetes operations and features, including `kubectl` command usage and general Kubernetes concepts, containing approximately 1,500 entries.
|
|
|
|
| 148 |
|
| 149 |
---
|
| 150 |
|
| 151 |
+
## Model Features
|
|
|
|
| 152 |
|
| 153 |
+
### 1. Command Generation in Bash Format
|
|
|
|
| 154 |
|
| 155 |
+
When the model generates CLI commands, it provides them in `bash` format, enclosed within code blocks for easy execution and clarity. This allows users to copy and paste the commands directly into their terminal.
|
| 156 |
|
| 157 |
+
### 2. Handling Ambiguity with Polite Clarifications
|
|
|
|
| 158 |
|
| 159 |
+
If the instruction is incomplete or ambiguous, the model will politely ask for the specific missing information instead of making assumptions. This ensures accuracy and prevents the execution of incorrect commands.
|
| 160 |
|
| 161 |
+
### 3. Providing Concise Explanations
|
| 162 |
|
| 163 |
+
For general Kubernetes questions, the model offers concise and accurate explanations without unnecessary details, helping users understand concepts quickly.
|
| 164 |
|
| 165 |
+
### 4. Enhanced Accuracy with 3B Model
|
| 166 |
|
| 167 |
+
The transition to the 3B model has significantly **reduced hallucinations** that sometimes occurred in the 1B model. The 3B model provides more accurate and reliable responses, improving the overall user experience.
|
|
|
|
| 168 |
|
| 169 |
+
---
|
| 170 |
|
| 171 |
+
## Examples
|
|
|
|
| 172 |
|
| 173 |
+
### Example 1: Generating a Command
|
| 174 |
|
| 175 |
+
**Instruction:**
|
| 176 |
|
| 177 |
+
```
|
| 178 |
+
Create a namespace called 'development'.
|
| 179 |
+
```
|
| 180 |
|
| 181 |
+
**Response:**
|
| 182 |
|
| 183 |
```bash
|
| 184 |
+
kubectl create namespace development
|
| 185 |
```
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
---
|
| 188 |
|
| 189 |
+
### Example 2: Handling Ambiguity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
+
**Instruction:**
|
| 192 |
|
| 193 |
+
```
|
| 194 |
+
Show me logs.
|
| 195 |
+
```
|
| 196 |
|
| 197 |
+
**Response:**
|
| 198 |
|
| 199 |
+
```
|
| 200 |
+
Which pod's logs would you like to retrieve?
|
| 201 |
+
```
|
| 202 |
|
| 203 |
---
|
| 204 |
|
| 205 |
+
### Example 3: Providing Explanations
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
+
**Instruction:**
|
| 208 |
|
| 209 |
+
```
|
| 210 |
+
What is a Deployment in Kubernetes?
|
| 211 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
|
| 213 |
+
**Response:**
|
| 214 |
|
| 215 |
+
```
|
| 216 |
+
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.
|
| 217 |
+
```
|
| 218 |
|
| 219 |
---
|
| 220 |
|
| 221 |
+
## Limitations and Considerations
|
| 222 |
|
| 223 |
+
- **Accuracy:** While the 3B model improves accuracy, the model may occasionally produce incorrect or suboptimal commands. Always review the output before execution.
|
| 224 |
+
- **Security:** Be cautious when executing generated commands, especially in production environments.
|
| 225 |
|
| 226 |
---
|
| 227 |
|
| 228 |
+
## Feedback and Contributions
|
|
|
|
|
|
|
| 229 |
|
| 230 |
+
We welcome any comments or participation to improve the model and dataset. If you encounter issues or have suggestions for improvement:
|
| 231 |
|
| 232 |
+
- **GitHub:** [Unsloth Repository](https://github.com/unslothai/unsloth)
|
| 233 |
+
- **Contact:** Reach out to the developer, **dereklck**, for further assistance.
|
| 234 |
|
| 235 |
---
|
| 236 |
|
| 237 |
+
**Note:** This model provides assistance in generating Kubernetes commands and explanations based on user input. Always verify the generated commands in a safe environment before executing them in a production cluster.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
|
| 239 |
---
|
| 240 |
|
| 241 |
+
If you have any further requests or need additional adjustments, please let me know!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|