dereklck commited on
Commit
3dc9394
·
verified ·
1 Parent(s): 2f3d8eb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +224 -8
README.md CHANGED
@@ -1,22 +1,238 @@
1
  ---
2
- base_model: unsloth/llama-3.2-3b-instruct-unsloth-bnb-4bit
3
  tags:
4
  - text-generation-inference
5
  - transformers
6
  - unsloth
7
  - llama
8
- - trl
9
- license: apache-2.0
 
10
  language:
11
  - en
 
12
  ---
13
 
14
- # Uploaded model
15
 
16
  - **Developed by:** dereklck
17
- - **License:** apache-2.0
18
- - **Finetuned from model :** unsloth/llama-3.2-3b-instruct-unsloth-bnb-4bit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
21
 
22
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ base_model: unsloth/Llama-3.2-1B-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 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 brief explanations about Kubernetes** for general queries.
28
+ 3. **Politely requesting additional information** if the instruction is incomplete or ambiguous.
29
+
30
+ **Important Note:** The **1B model may sometimes generate non-executable CLI commands containing placeholders** like `<pod_name>` or `<resource_name>`. This can lead to hallucinations and commands that cannot be executed directly. Users are advised to replace these placeholders with actual values before execution. This issue has been significantly **improved in the 3B model**, which generates more accurate and executable commands without unnecessary placeholders.
31
+
32
+ ---
33
+
34
+ ## Model Details
35
+
36
+ ### Purpose
37
+
38
+ The model assists users by:
39
+
40
+ - **Generating `kubectl` commands** based on natural language descriptions.
41
+ - **Providing brief explanations about Kubernetes** for general queries.
42
+ - **Politely requesting additional information** if the instruction is incomplete or ambiguous.
43
+
44
+ ### Intended Users
45
+
46
+ - Kubernetes administrators
47
+ - DevOps engineers
48
+ - Developers working with Kubernetes clusters
49
+
50
+ ### Training Process
51
+
52
+ - **Base Model:** Unsloth's Llama-3.2-1B-Instruct-bnb-4bit
53
+ - **Fine-tuning:** Utilized the Unsloth framework and Hugging Face's TRL library for efficient training.
54
+ - **Training Data:** Customized dataset focused on Kubernetes operations and `kubectl` command usage, containing approximately 200 entries.
55
+
56
+ ---
57
+
58
+ ## Model Features
59
+
60
+ ### 1. Command Generation in Bash Format
61
+
62
+ 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.
63
+
64
+ ### 2. Handling Ambiguity with Polite Clarifications
65
+
66
+ If the instruction is incomplete or ambiguous, the model politely asks for the specific missing information instead of making assumptions. This ensures accuracy and prevents the execution of incorrect commands.
67
+
68
+ ### 3. Providing Concise Explanations
69
+
70
+ For general Kubernetes questions, the model offers concise and accurate explanations without unnecessary details, helping users understand concepts quickly.
71
+
72
+ ---
73
+
74
+ ## Usage
75
+
76
+ ### Parameters
77
+
78
+ - **Temperature:** `0.3` (controls randomness; lower values make outputs more deterministic)
79
+ - **Stop Token:** `</s>` (indicates the end of the assistant's response)
80
+
81
+ ---
82
+
83
+ ## Examples
84
+
85
+ ### Example 1: Generating a Command
86
+
87
+ **Instruction:**
88
+
89
+ ```
90
+ Create a namespace called 'development'.
91
+ ```
92
+
93
+ **Response:**
94
+
95
+ ```bash
96
+ kubectl create namespace development
97
+ ```
98
+
99
+ ---
100
+
101
+ ### Example 2: Handling Ambiguity
102
+
103
+ **Instruction:**
104
+
105
+ ```
106
+ Show me logs.
107
+ ```
108
+
109
+ **Response:**
110
+
111
+ ```
112
+ Which pod's logs would you like to retrieve?
113
+ ```
114
+
115
+ ---
116
+
117
+ ### Example 3: Providing Explanations
118
+
119
+ **Instruction:**
120
+
121
+ ```
122
+ What is a Deployment in Kubernetes?
123
+ ```
124
 
125
+ **Response:**
126
 
127
+ ```
128
+ 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.
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Limitations and Considerations
134
+
135
+ - **Accuracy:** The model may occasionally produce incorrect or suboptimal commands. Always review the output before execution.
136
+ - **Hallucinations:** The **1B model may generate CLI commands with placeholders** (e.g., `<pod_name>`, `<resource_name>`), resulting in commands that are **not directly executable**. Users should carefully replace these placeholders with actual values.
137
+
138
+ - **Improvement in 3B Model:** This issue has been addressed in the **3B model**, where the generation of non-executable commands with placeholders has been significantly reduced, providing more accurate and usable outputs.
139
+
140
+ - **Security:** Be cautious when executing generated commands, especially in production environments.
141
+
142
+ ---
143
+
144
+ ## Future Revisions
145
+
146
+ - **Addressing Hallucinations:** Efforts are underway to further reduce hallucinations in future versions, building upon improvements made in the 3B model.
147
+ - **Enhanced Dataset:** Expanding the training dataset to include a wider range of Kubernetes operations to improve the model's versatility.
148
+ - **Fine-tuning Techniques:** Implementing advanced fine-tuning methods to enhance accuracy and reliability.
149
+
150
+ ---
151
+
152
+ ## Deployment with Ollama
153
+
154
+ ### Prerequisites
155
+
156
+ - Install [Ollama](https://github.com/jmorganca/ollama) on your system.
157
+ - Ensure you have the GGUF model file (e.g., `kubectl_operator.Q8_0.gguf`).
158
+
159
+ ### Steps
160
+
161
+ 1. **Create the Modelfile**
162
+
163
+ Save the following content as a file named `Modelfile`:
164
+
165
+ ```plaintext
166
+ FROM kubectl_operator.Q8_0.gguf
167
+
168
+ PARAMETER temperature 0.3
169
+ PARAMETER stop "</s>"
170
+
171
+ TEMPLATE """
172
+ You are an AI assistant that helps users with Kubernetes commands and questions.
173
+
174
+ **Your Behavior Guidelines:**
175
+
176
+ 1. **For clear and complete instructions:**
177
+ - **Provide only** the exact `kubectl` command needed to fulfill the user's request.
178
+ - Do not include extra explanations, placeholders, or context.
179
+ - **Enclose the command within a code block** with `bash` syntax highlighting.
180
+
181
+ 2. **For incomplete or ambiguous instructions:**
182
+ - **Politely ask** the user for the specific missing information.
183
+ - Do **not** provide any commands or placeholders in your response.
184
+ - Respond in plain text, clearly stating what information is needed.
185
+
186
+ 3. **For general Kubernetes questions:**
187
+ - Provide a **concise and accurate explanation**.
188
+ - Do **not** include any commands unless specifically requested.
189
+ - Ensure that the explanation fully addresses the user's question.
190
+
191
+ **Important Rules:**
192
+
193
+ - **Do not generate CLI commands containing placeholders** (e.g., `<pod_name>`, `<resource_name>`).
194
+ - Ensure all CLI commands are **complete, valid, and executable** as provided.
195
+ - If user input is insufficient to form a complete command, **ask for clarification** instead of using placeholders.
196
+ - Provide only the necessary CLI command output without any additional text.
197
+
198
+ ### Instruction:
199
+ {{ .Prompt }}
200
+
201
+ ### Response:
202
+ """
203
+ ```
204
+
205
+ 2. **Create the Model with Ollama**
206
+
207
+ Open your terminal and run the following command to create the model:
208
+
209
+ ```bash
210
+ ollama create kubectl_operator -f Modelfile
211
+ ```
212
+
213
+ This command tells Ollama to create a new model named `kubectl_operator` using the configuration specified in `Modelfile`.
214
+
215
+ 3. **Run the Model**
216
+
217
+ Start interacting with your model:
218
+
219
+ ```bash
220
+ ollama run kubectl_operator
221
+ ```
222
+
223
+ This will initiate the model and prompt you for input based on the template provided.
224
+
225
+ ---
226
+
227
+ ## Feedback and Contributions
228
+
229
+ We welcome any comments or participation to improve the model and dataset. If you encounter issues or have suggestions for improvement:
230
+
231
+ - **GitHub:** [Unsloth Repository](https://github.com/unslothai/unsloth)
232
+ - **Contact:** Reach out to the developer, **dereklck**, for further assistance.
233
+
234
+ ---
235
+
236
+ **Note:** This model assists in generating `kubectl` commands based on user input. Always verify the generated commands and replace any placeholders with actual values before executing them in a production cluster.
237
+
238
+ ---