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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
-
|
|
|
|
| 1 |
+
# π€ Qwen Alpaca GGUF
|
| 2 |
+
|
| 3 |
+
A fine tuned **Qwen2.5-0.5B-Instruct** language model trained on the **tatsu-lab/alpaca** instruction dataset. The model was fine tuned using **Unsloth**, quantized to **GGUF (Q4_K_M)**, and can be run locally with **Ollama** or **llama.cpp**.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## π Model Details
|
| 8 |
+
|
| 9 |
+
| Property | Value |
|
| 10 |
+
|----------|-------|
|
| 11 |
+
| Base Model | Qwen2.5-0.5B-Instruct |
|
| 12 |
+
| Fine Tuning | LoRA |
|
| 13 |
+
| Framework | Unsloth |
|
| 14 |
+
| Dataset | tatsu-lab/alpaca |
|
| 15 |
+
| Format | GGUF |
|
| 16 |
+
| Quantization | Q4_K_M |
|
| 17 |
+
| Inference | Ollama, llama.cpp |
|
| 18 |
+
| Language | English |
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## β¨ Features
|
| 23 |
+
|
| 24 |
+
- Instruction following chatbot
|
| 25 |
+
- Lightweight 0.5B parameter model
|
| 26 |
+
- GGUF format for efficient CPU inference
|
| 27 |
+
- Optimized using Q4_K_M quantization
|
| 28 |
+
- Compatible with Ollama
|
| 29 |
+
- Compatible with llama.cpp
|
| 30 |
+
- Easy local deployment
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## π¦ Model File
|
| 35 |
+
|
| 36 |
+
```
|
| 37 |
+
Qwen2.5-0.5B-Instruct.Q4_K_M.gguf
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
# π Fine Tuning Pipeline
|
| 43 |
+
|
| 44 |
+
```
|
| 45 |
+
Base Model
|
| 46 |
+
β
|
| 47 |
+
βΌ
|
| 48 |
+
Qwen2.5-0.5B-Instruct
|
| 49 |
+
β
|
| 50 |
+
βΌ
|
| 51 |
+
Alpaca Instruction Dataset
|
| 52 |
+
β
|
| 53 |
+
βΌ
|
| 54 |
+
LoRA Fine Tuning
|
| 55 |
+
β
|
| 56 |
+
βΌ
|
| 57 |
+
Unsloth
|
| 58 |
+
β
|
| 59 |
+
βΌ
|
| 60 |
+
Merge LoRA Adapters
|
| 61 |
+
β
|
| 62 |
+
βΌ
|
| 63 |
+
GGUF Conversion
|
| 64 |
+
β
|
| 65 |
+
βΌ
|
| 66 |
+
Q4_K_M Quantization
|
| 67 |
+
β
|
| 68 |
+
βΌ
|
| 69 |
+
Inference using Ollama / llama.cpp
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
---
|
| 73 |
+
|
| 74 |
+
# π Dataset
|
| 75 |
+
|
| 76 |
+
This model was fine tuned using the **tatsu-lab/alpaca** instruction dataset.
|
| 77 |
+
|
| 78 |
+
The dataset contains thousands of instruction and response pairs designed to improve instruction following ability.
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
# β‘ Run with Ollama
|
| 83 |
+
|
| 84 |
+
Create a Modelfile
|
| 85 |
+
|
| 86 |
+
```text
|
| 87 |
+
FROM ./Qwen2.5-0.5B-Instruct.Q4_K_M.gguf
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
Create the model
|
| 91 |
+
|
| 92 |
+
```bash
|
| 93 |
+
ollama create fineqwen -f Modelfile
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
Run the model
|
| 97 |
+
|
| 98 |
+
```bash
|
| 99 |
+
ollama run fineqwen
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
# π₯ Example Terminal
|
| 105 |
+
|
| 106 |
+
```text
|
| 107 |
+
$ ollama create fineqwen -f Modelfile
|
| 108 |
+
|
| 109 |
+
transferring model...
|
| 110 |
+
creating new layer...
|
| 111 |
+
writing manifest...
|
| 112 |
+
success
|
| 113 |
+
|
| 114 |
+
$ ollama run fineqwen
|
| 115 |
+
|
| 116 |
+
>>> Explain Transformers in simple words.
|
| 117 |
+
|
| 118 |
+
Transformers are neural networks designed to process sequences using
|
| 119 |
+
self-attention, allowing them to understand relationships between words
|
| 120 |
+
efficiently.
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
# π¦ Run using llama.cpp
|
| 126 |
+
|
| 127 |
+
```bash
|
| 128 |
+
llama-cli \
|
| 129 |
+
-hf ciphermosaic/qwen-alpaca-gguf \
|
| 130 |
+
--jinja
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
or
|
| 134 |
+
|
| 135 |
+
```bash
|
| 136 |
+
llama-cli \
|
| 137 |
+
-m Qwen2.5-0.5B-Instruct.Q4_K_M.gguf
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
---
|
| 141 |
+
|
| 142 |
+
# π Hugging Face Space
|
| 143 |
+
|
| 144 |
+
Interactive chatbot available on Hugging Face Spaces.
|
| 145 |
+
|
| 146 |
+
---
|
| 147 |
+
|
| 148 |
+
# π Quantization
|
| 149 |
+
|
| 150 |
+
This model uses
|
| 151 |
+
|
| 152 |
+
```
|
| 153 |
+
Q4_K_M
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
Benefits
|
| 157 |
+
|
| 158 |
+
- Smaller model size
|
| 159 |
+
- Faster inference
|
| 160 |
+
- Lower RAM usage
|
| 161 |
+
- Minimal quality loss
|
| 162 |
+
|
| 163 |
+
---
|
| 164 |
+
|
| 165 |
+
# π§° Tech Stack
|
| 166 |
+
|
| 167 |
+
- Python
|
| 168 |
+
- Hugging Face Transformers
|
| 169 |
+
- Unsloth
|
| 170 |
+
- PEFT (LoRA)
|
| 171 |
+
- GGUF
|
| 172 |
+
- llama.cpp
|
| 173 |
+
- Ollama
|
| 174 |
+
- Hugging Face Hub
|
| 175 |
+
- Gradio
|
| 176 |
+
|
| 177 |
+
---
|
| 178 |
+
|
| 179 |
+
# π Repository Structure
|
| 180 |
+
|
| 181 |
+
```
|
| 182 |
+
.
|
| 183 |
+
βββ Modelfile
|
| 184 |
+
βββ Qwen2.5-0.5B-Instruct.Q4_K_M.gguf
|
| 185 |
+
βββ README.md
|
| 186 |
+
βββ config.json
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
---
|
| 190 |
+
|
| 191 |
+
# π¨βπ» Author
|
| 192 |
+
|
| 193 |
+
**CipherMosaic**
|
| 194 |
+
|
| 195 |
+
GitHub: https://github.com/CipherMosaic
|
| 196 |
+
|
| 197 |
+
Hugging Face: https://huggingface.co/ciphermosaic
|
| 198 |
+
|
| 199 |
---
|
| 200 |
|
| 201 |
+
## β If you found this project useful, consider giving it a star!
|