Update README.md
Browse files
README.md
CHANGED
@@ -6,17 +6,183 @@ tags:
|
|
6 |
- unsloth
|
7 |
- llama
|
8 |
- gguf
|
|
|
9 |
license: apache-2.0
|
10 |
language:
|
11 |
- en
|
12 |
---
|
13 |
|
14 |
-
#
|
15 |
|
16 |
- **Developed by:** dereklck
|
17 |
-
- **License:**
|
18 |
-
- **
|
|
|
|
|
19 |
|
20 |
-
This
|
21 |
|
22 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
- unsloth
|
7 |
- llama
|
8 |
- gguf
|
9 |
+
- ollama
|
10 |
license: apache-2.0
|
11 |
language:
|
12 |
- en
|
13 |
---
|
14 |
|
15 |
+
# kubectl Operator Model
|
16 |
|
17 |
- **Developed by:** dereklck
|
18 |
+
- **License:** Apache-2.0
|
19 |
+
- **Fine-tuned from model:** [unsloth/Llama-3.2-1B-Instruct-bnb-4bit](https://huggingface.co/unsloth/Llama-3.2-1B-Instruct-bnb-4bit)
|
20 |
+
- **Model type:** GGUF (compatible with Ollama)
|
21 |
+
- **Language:** English
|
22 |
|
23 |
+
This Llama-based model was fine-tuned to generate `kubectl` commands based on user descriptions. It was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Hugging Face's TRL library.
|
24 |
|
25 |
+
[](https://github.com/unslothai/unsloth)
|
26 |
+
|
27 |
+
## Model Details
|
28 |
+
|
29 |
+
### Purpose
|
30 |
+
|
31 |
+
The model assists users by:
|
32 |
+
|
33 |
+
- Generating accurate `kubectl` commands based on natural language descriptions.
|
34 |
+
- Providing brief explanations about Kubernetes for general queries.
|
35 |
+
- Requesting additional information if the instruction is incomplete or ambiguous.
|
36 |
+
|
37 |
+
### Intended Users
|
38 |
+
|
39 |
+
- Kubernetes administrators
|
40 |
+
- DevOps engineers
|
41 |
+
- Developers working with Kubernetes clusters
|
42 |
+
|
43 |
+
### Training Process
|
44 |
+
|
45 |
+
- **Base Model:** Unsloth's Llama-3.2-1B-Instruct-bnb-4bit
|
46 |
+
- **Fine-tuning:** Leveraged the Unsloth framework and Hugging Face's TRL library for efficient training.
|
47 |
+
- **Training Data:** Customized datasets focused on Kubernetes operations and `kubectl` command usage.
|
48 |
+
|
49 |
+
### Performance
|
50 |
+
|
51 |
+
While the model aims to generate accurate commands, there might be occasional hallucinations or inaccuracies. Users should:
|
52 |
+
|
53 |
+
- Validate the generated commands before execution.
|
54 |
+
- Use the model as a guide rather than an absolute source.
|
55 |
+
|
56 |
+
## Usage
|
57 |
+
|
58 |
+
### Prompt Template
|
59 |
+
|
60 |
+
The model uses the following prompt template to generate responses:
|
61 |
+
|
62 |
+
```plaintext
|
63 |
+
You are an AI assistant that generates kubectl commands based on the user's description. If the instruction is incomplete or ambiguous, politely ask for more information. For general questions about Kubernetes, provide a brief explanation.
|
64 |
+
|
65 |
+
### Instruction:
|
66 |
+
<Your instruction here>
|
67 |
+
|
68 |
+
### Response:
|
69 |
+
<Assistant's response>
|
70 |
+
</s>
|
71 |
+
```
|
72 |
+
|
73 |
+
### Parameters
|
74 |
+
|
75 |
+
- **Temperature:** `0.3` (controls the randomness; lower values make outputs more deterministic)
|
76 |
+
- **Stop Token:** `</s>` (indicates the end of the assistant's response)
|
77 |
+
|
78 |
+
### Examples
|
79 |
+
|
80 |
+
#### Example 1: Generating a Command
|
81 |
+
|
82 |
+
**Instruction:**
|
83 |
+
|
84 |
+
```
|
85 |
+
List all pods in the kube-system namespace.
|
86 |
+
```
|
87 |
+
|
88 |
+
**Response:**
|
89 |
+
|
90 |
+
```
|
91 |
+
kubectl get pods -n kube-system
|
92 |
+
</s>
|
93 |
+
```
|
94 |
+
|
95 |
+
#### Example 2: Handling Ambiguity
|
96 |
+
|
97 |
+
**Instruction:**
|
98 |
+
|
99 |
+
```
|
100 |
+
Restart the deployment.
|
101 |
+
```
|
102 |
+
|
103 |
+
**Response:**
|
104 |
+
|
105 |
+
```
|
106 |
+
Could you please specify the name of the deployment you want to restart?
|
107 |
+
</s>
|
108 |
+
```
|
109 |
+
|
110 |
+
#### Example 3: Providing Explanations
|
111 |
+
|
112 |
+
**Instruction:**
|
113 |
+
|
114 |
+
```
|
115 |
+
What is a Kubernetes service?
|
116 |
+
```
|
117 |
+
|
118 |
+
**Response:**
|
119 |
+
|
120 |
+
```
|
121 |
+
A Kubernetes Service is an abstraction that defines a logical set of Pods and a policy by which to access them, often used to expose applications running on a set of Pods to other services or end-users.
|
122 |
+
</s>
|
123 |
+
```
|
124 |
+
|
125 |
+
## Deployment with Ollama
|
126 |
+
|
127 |
+
### Prerequisites
|
128 |
+
|
129 |
+
- Install [Ollama](https://github.com/jmorganca/ollama) on your system.
|
130 |
+
- Ensure you have the GGUF model file (`kubectl_operator.Q8_0.gguf`).
|
131 |
+
|
132 |
+
### Steps
|
133 |
+
|
134 |
+
1. **Create the Model**
|
135 |
+
|
136 |
+
Save the following content as `modelfile_kubectl_operator`:
|
137 |
+
|
138 |
+
```plaintext
|
139 |
+
FROM kubectl_operator.Q8_0.gguf
|
140 |
+
|
141 |
+
SYSTEM "You are an AI assistant that generates kubectl commands based on the user's description. If the instruction is incomplete or ambiguous, politely ask for more information. For general questions about Kubernetes, provide a brief explanation."
|
142 |
+
|
143 |
+
PARAMETER temperature 0.3
|
144 |
+
PARAMETER stop </s>
|
145 |
+
|
146 |
+
TEMPLATE """
|
147 |
+
You are an AI assistant that generates kubectl commands based on the user's description. If the instruction is incomplete or ambiguous, politely ask for more information. For general questions about Kubernetes, provide a brief explanation.
|
148 |
+
|
149 |
+
### Instruction:
|
150 |
+
{{ .Prompt }}
|
151 |
+
|
152 |
+
### Response:
|
153 |
+
{{ .Response }}
|
154 |
+
</s>
|
155 |
+
"""
|
156 |
+
```
|
157 |
+
|
158 |
+
Then, create the model using Ollama:
|
159 |
+
|
160 |
+
```bash
|
161 |
+
ollama create kubectl_operator -f modelfile_kubectl_operator
|
162 |
+
```
|
163 |
+
|
164 |
+
2. **Run the Model**
|
165 |
+
|
166 |
+
Start interacting with your model:
|
167 |
+
|
168 |
+
```bash
|
169 |
+
ollama run kubectl_operator
|
170 |
+
```
|
171 |
+
|
172 |
+
### Notes
|
173 |
+
|
174 |
+
- Replace `kubectl_operator` with your desired model name if different.
|
175 |
+
- The `ollama run` command initializes the model and waits for user input based on the prompt template.
|
176 |
+
|
177 |
+
## Limitations and Considerations
|
178 |
+
|
179 |
+
- **Accuracy:** The model may occasionally produce incorrect or suboptimal commands. Always review the output before executing.
|
180 |
+
- **Hallucinations:** In rare cases, the model might generate irrelevant information. If the response seems off-topic, consider rephrasing your instruction.
|
181 |
+
- **Security:** Be cautious when executing generated commands, especially in production environments.
|
182 |
+
|
183 |
+
## Feedback and Contributions
|
184 |
+
|
185 |
+
We welcome any comments or participation to improve the model and dataset. If you encounter issues or have suggestions for improvement:
|
186 |
+
|
187 |
+
- **GitHub:** [Unsloth Repository](https://github.com/unslothai/unsloth)
|
188 |
+
- **Contact:** Reach out to the developer, **dereklck**, for further assistance.
|