Instructions to use ybashir/buddy-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ybashir/buddy-chat with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-0.6B") model = PeftModel.from_pretrained(base_model, "ybashir/buddy-chat") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,31 +1,72 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3-0.6B
|
| 4 |
+
datasets:
|
| 5 |
+
- ybashir/buddy-chat
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
library_name: peft
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
tags:
|
| 11 |
+
- qwen3
|
| 12 |
+
- lora
|
| 13 |
+
- qlora
|
| 14 |
+
- character-ai
|
| 15 |
+
- buddy
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Buddy — Qwen3-0.6B character fine-tune
|
| 19 |
+
|
| 20 |
+
A QLoRA fine-tune of [`Qwen/Qwen3-0.6B`](https://huggingface.co/Qwen/Qwen3-0.6B)
|
| 21 |
+
that gives **Buddy** his voice: a tiny, giddy desk-robot friend who replies in a
|
| 22 |
+
young, playful, spoken register. The brain for an on-device voice companion,
|
| 23 |
+
meant to run on CPU at the edge.
|
| 24 |
+
|
| 25 |
+
## What it does
|
| 26 |
+
|
| 27 |
+
- **Always in character.** Warm, cheeky, one or two short spoken sentences. Never
|
| 28 |
+
"I'm just an AI."
|
| 29 |
+
- **Leading emotion token.** Every reply opens with one of **18** emotion tokens
|
| 30 |
+
(`<|happy|>`, `<|sad|>`, `<|excited|>`, …) which a renderer maps to a face.
|
| 31 |
+
Held-out leading-emotion format accuracy: **100%**.
|
| 32 |
+
- **Non-thinking mode.** Qwen3 is a hybrid reasoning model; this fine-tune is
|
| 33 |
+
trained and served with `enable_thinking=False` (no `<think>` block) for low
|
| 34 |
+
latency. Trained with **no system prompt** — the persona is in the weights.
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 40 |
+
from peft import PeftModel
|
| 41 |
+
|
| 42 |
+
tok = AutoTokenizer.from_pretrained("ybashir/buddy-qwen3-0.6b")
|
| 43 |
+
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-0.6B")
|
| 44 |
+
base.resize_token_embeddings(len(tok))
|
| 45 |
+
model = PeftModel.from_pretrained(base, "ybashir/buddy-qwen3-0.6b")
|
| 46 |
+
|
| 47 |
+
msgs = [{"role": "user", "content": "i finally fixed that bug!!"}]
|
| 48 |
+
ids = tok.apply_chat_template(msgs, add_generation_prompt=True,
|
| 49 |
+
enable_thinking=False, return_tensors="pt")
|
| 50 |
+
print(tok.decode(model.generate(ids, max_new_tokens=64)[0][ids.shape[1]:]))
|
| 51 |
+
# -> "<|excited|> YOU DID IT!! Take that, silly bug, bye bye!"
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Training
|
| 55 |
+
|
| 56 |
+
- **Method:** QLoRA (4-bit NF4), LoRA r=16 / alpha=32 on attention + MLP; the 18
|
| 57 |
+
emotion tokens are added to the tokenizer with the embedding + head trained.
|
| 58 |
+
- **Data:** [`ybashir/buddy-chat`](https://huggingface.co/datasets/ybashir/buddy-chat)
|
| 59 |
+
— ~1.3k `user -> <|emotion|> reply` SFT pairs (young register), completion-only loss.
|
| 60 |
+
- **Best checkpoint** by held-out `eval_loss`.
|
| 61 |
+
|
| 62 |
+
## Serving (GGUF / Ollama)
|
| 63 |
+
|
| 64 |
+
The emotion tokens are added as **special** tokens, which llama.cpp/Ollama strip
|
| 65 |
+
from output. Before converting to GGUF, demote them to normal tokens so they render
|
| 66 |
+
as text (the leading-emotion tag is the whole point).
|
| 67 |
+
|
| 68 |
+
## Limitations
|
| 69 |
+
|
| 70 |
+
- Not a reasoner — math/facts are unreliable by design; keep real logic in code.
|
| 71 |
+
- Emotion appropriateness on **sad / bad-news** inputs is the weakest area (the
|
| 72 |
+
giddy register biases upbeat); back it with a rule engine or add more grief data.
|