ybashir commited on
Commit
9fef65f
·
verified ·
1 Parent(s): 486e742

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -31
README.md CHANGED
@@ -1,31 +1,72 @@
1
- # Buddy's fine-tuned brain — Qwen3-0.6B, non-thinking, emotion-tagged.
2
- # Build: ollama create buddy-qwen3 -f Modelfile
3
- # (run from the dir holding buddy-qwen3-0.6b.gguf, or fix the FROM path)
4
- FROM ./buddy-qwen3-0.6b.gguf
5
-
6
- # Non-thinking chat template: matches how the model was trained (an empty
7
- # <think></think> block, then the reply that starts with a <|emotion|> token).
8
- # No system prompt is injected — the persona lives in the weights.
9
- TEMPLATE """{{- range $i, $m := .Messages -}}
10
- {{- if eq $m.Role "system" }}<|im_start|>system
11
- {{ $m.Content }}<|im_end|>
12
- {{ end -}}
13
- {{- if eq $m.Role "user" }}<|im_start|>user
14
- {{ $m.Content }}<|im_end|>
15
- {{ end -}}
16
- {{- if eq $m.Role "assistant" }}<|im_start|>assistant
17
- {{ $m.Content }}<|im_end|>
18
- {{ end -}}
19
- {{- end -}}
20
- {{- if .AddGenerationPrompt }}<|im_start|>assistant
21
- <think>
22
-
23
- </think>
24
-
25
- {{ end -}}"""
26
-
27
- # Buddy stays snappy; a bit hot so the young voice isn't flat.
28
- PARAMETER temperature 0.8
29
- PARAMETER top_p 0.9
30
- PARAMETER num_predict 120
31
- PARAMETER stop "<|im_end|>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.