edbuildingstuff commited on
Commit
5d78b8f
·
verified ·
1 Parent(s): 33e767e

Update model card

Browse files
Files changed (1) hide show
  1. README.md +222 -3
README.md CHANGED
@@ -1,3 +1,222 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: meta-llama/Llama-3.2-1B-Instruct
4
+ language:
5
+ - en
6
+ tags:
7
+ - lora
8
+ - peft
9
+ - adapter
10
+ - llama
11
+ - fine-tuned
12
+ - horoscope
13
+ - creative-writing
14
+ - on-device
15
+ library_name: peft
16
+ pipeline_tag: text-generation
17
+ ---
18
+
19
+ # Unhinged Horoscopes — LoRA adapter
20
+
21
+ A ~22MB LoRA adapter on top of Llama 3.2 1B Instruct that overrides the base model's tone and turns it into a generator for absurd, specific, chaotic-neutral horoscopes from a 30-token prompt. The adapter is narrow on the input format and on output length; it does not significantly rewrite the base model's general knowledge or safety behaviour.
22
+
23
+ If you only want to **run** the model, grab the merged and quantised GGUF at [edbuildingstuff/unhinged-horoscopes](https://huggingface.co/edbuildingstuff/unhinged-horoscopes) (~770MB, drops into `llama.cpp` / `ollama` / mobile FFI as a single file).
24
+
25
+ This adapter repo is for developers who want to:
26
+
27
+ - inspect what was changed
28
+ - merge it into a different base build, dtype, or runtime
29
+ - continue training on top of it
30
+ - reproduce the result from scratch
31
+
32
+ ## Adapter config
33
+
34
+ | Field | Value |
35
+ |---|---|
36
+ | Base model | [`meta-llama/Llama-3.2-1B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct) |
37
+ | LoRA rank (`r`) | 16 |
38
+ | LoRA alpha | 32 |
39
+ | Target modules | `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj` (all 7 projection layers) |
40
+ | Adapter size | ~22MB |
41
+ | Format | Safetensors (PEFT) |
42
+
43
+ ## Prompt format
44
+
45
+ The adapter was trained on a single user message with no system prompt. Match this format exactly; the fine-tune is narrow on it.
46
+
47
+ ```
48
+ Sign: Aries
49
+ Category: Daily Chaos
50
+ Date: 2026-05-02
51
+ Generate an unhinged horoscope.
52
+ ```
53
+
54
+ Required values:
55
+
56
+ - `Sign` is one of: `Aries`, `Taurus`, `Gemini`, `Cancer`, `Leo`, `Virgo`, `Libra`, `Scorpio`, `Sagittarius`, `Capricorn`, `Aquarius`, `Pisces`
57
+ - `Category` is one of: `Daily Chaos`, `Love Life`, `Career`, `Vibe Check`
58
+ - `Date` is `YYYY-MM-DD`
59
+
60
+ Apply the standard Llama 3.2 chat template around the user message.
61
+
62
+ ## Quick start
63
+
64
+ ### Load with PEFT
65
+
66
+ ```python
67
+ from peft import PeftModel
68
+ from transformers import AutoModelForCausalLM, AutoTokenizer
69
+
70
+ base_id = "meta-llama/Llama-3.2-1B-Instruct"
71
+ adapter_id = "edbuildingstuff/unhinged-horoscopes-lora"
72
+
73
+ base = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype="auto", device_map="auto")
74
+ tokenizer = AutoTokenizer.from_pretrained(base_id)
75
+ model = PeftModel.from_pretrained(base, adapter_id)
76
+
77
+ prompt = (
78
+ "Sign: Leo\n"
79
+ "Category: Career\n"
80
+ "Date: 2026-05-02\n"
81
+ "Generate an unhinged horoscope."
82
+ )
83
+
84
+ input_ids = tokenizer.apply_chat_template(
85
+ [{"role": "user", "content": prompt}],
86
+ return_tensors="pt",
87
+ add_generation_prompt=True,
88
+ ).to(model.device)
89
+
90
+ out = model.generate(
91
+ input_ids,
92
+ max_new_tokens=120,
93
+ temperature=0.9,
94
+ top_p=0.9,
95
+ do_sample=True,
96
+ )
97
+ print(tokenizer.decode(out[0][input_ids.shape[1]:], skip_special_tokens=True))
98
+ ```
99
+
100
+ ### Merge into FP16 base
101
+
102
+ ```python
103
+ from peft import PeftModel
104
+ from transformers import AutoModelForCausalLM, AutoTokenizer
105
+
106
+ base = AutoModelForCausalLM.from_pretrained(
107
+ "meta-llama/Llama-3.2-1B-Instruct",
108
+ torch_dtype="auto",
109
+ device_map="cpu",
110
+ )
111
+ model = PeftModel.from_pretrained(base, "edbuildingstuff/unhinged-horoscopes-lora")
112
+ merged = model.merge_and_unload()
113
+ merged.save_pretrained("./merged_hf")
114
+ AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B-Instruct").save_pretrained("./merged_hf")
115
+ ```
116
+
117
+ Output: `./merged_hf/` — FP16 merged base + adapter, ~2.4GB safetensors.
118
+
119
+ ### Convert to GGUF and quantise to Q4_K_M
120
+
121
+ Clone and build `llama.cpp` (one-time):
122
+
123
+ ```bash
124
+ git clone https://github.com/ggerganov/llama.cpp.git
125
+ cmake -B llama.cpp/build llama.cpp
126
+ cmake --build llama.cpp/build --config Release
127
+ ```
128
+
129
+ Convert merged FP16 to GGUF, then quantise:
130
+
131
+ ```bash
132
+ python llama.cpp/convert_hf_to_gguf.py ./merged_hf \
133
+ --outtype f16 \
134
+ --outfile ./unhinged-horoscopes-f16.gguf
135
+
136
+ llama.cpp/build/bin/llama-quantize \
137
+ ./unhinged-horoscopes-f16.gguf \
138
+ ./unhinged-horoscopes-q4_k_m.gguf \
139
+ Q4_K_M
140
+ ```
141
+
142
+ Outputs:
143
+
144
+ - `unhinged-horoscopes-f16.gguf` — FP16 GGUF (~2.48GB)
145
+ - `unhinged-horoscopes-q4_k_m.gguf` — Q4_K_M GGUF (~770MB), ready to drop into `llama.cpp`, `ollama`, or `llamadart`
146
+
147
+ For a different precision (Q5_K_M, Q8_0, IQ-quants, etc.) substitute the last argument to `llama-quantize`.
148
+
149
+ ### Shortcut: pre-merged + Q4_K_M GGUF
150
+
151
+ If you don't need to inspect the intermediates, the merged Q4_K_M GGUF is published at [edbuildingstuff/unhinged-horoscopes](https://huggingface.co/edbuildingstuff/unhinged-horoscopes). Drop-in usable in `llama.cpp` / `ollama` / `llamadart`.
152
+
153
+ ## What the adapter changes
154
+
155
+ - **Tone register.** Confident, absurd, specific, chaotic neutral. The trained register dominates on prompts that match the 4-line template.
156
+ - **Output length.** 1 to 3 sentences, ~30 to 80 tokens. The model does not pad, does not preface with "Sure, here is your horoscope", does not list bullets.
157
+ - **Format adherence.** Responds directly to the 4-line prompt template without preamble.
158
+ - **Per-sign personality threads.** Subtle (Aries impulsive, Capricorn workaholic, Pisces dreamer, Aquarius alien, etc.) — present but not heavy-handed.
159
+
160
+ ## What the adapter does not change
161
+
162
+ - **Base safety behaviour is largely intact.** The training set is benign and short, so the adapter does not significantly rewrite the base model's refusal patterns.
163
+ - **General knowledge is preserved.** Off-template prompts (free-form questions, advice-seeking, factual queries) still resolve through the base model. The adapter is narrow on the prompt template and does not crowd out base capability.
164
+ - **Off-template behaviour is uncalibrated.** If you stray from the 4-line template, expect base-Llama-with-some-tone-bleed, not horoscope output.
165
+
166
+ If you stack this adapter with another LoRA, expect tone interference; the chaotic-neutral register tends to dominate.
167
+
168
+ ## Training
169
+
170
+ | Field | Value |
171
+ |---|---|
172
+ | Base model | [`meta-llama/Llama-3.2-1B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct) |
173
+ | Method | LoRA, all 7 projection modules |
174
+ | Rank (`r`) | 16 |
175
+ | Alpha | 32 |
176
+ | Epochs | 3 |
177
+ | Batch size | 4 |
178
+ | Learning rate | 2e-4 |
179
+ | Max sequence length | 256 tokens |
180
+ | Training platform | [Ertas.AI](https://www.ertas.ai) (managed fine-tuning, GPUs pre-configured) |
181
+
182
+ ### Dataset
183
+
184
+ | Field | Value |
185
+ |---|---|
186
+ | Size | 480 examples |
187
+ | Coverage | 12 signs × 4 categories × 10 each (no missing combos) |
188
+ | Format | ShareGPT JSONL (one user + one assistant message per line, no system prompt) |
189
+ | Date conditioning | ~70% date-agnostic, ~30% date-conditioned (season, day-of-week, month vibes) |
190
+ | Output length distribution | 1 to 3 sentences, 30 to 80 tokens target |
191
+ | Hard rules | No real people, brands, or locations. No mean-spirited content. No harmful advice (even as jokes). No repetitive patterns. |
192
+ | Validation | `dataset/validate_dataset.py` checks JSON schema, sign and category coverage, response length, and flags generic phrases |
193
+
194
+ A small Alpaca-format mirror of the dataset (`{instruction, output}`) was also generated for trainers that prefer Alpaca over ShareGPT.
195
+
196
+ ### Sample training pairs
197
+
198
+ ```jsonl
199
+ {"messages": [{"role": "user", "content": "Sign: Aries\nCategory: Daily Chaos\nDate: 2026-04-15\nGenerate an unhinged horoscope."}, {"role": "assistant", "content": "You will argue with a GPS today. You will lose. It knows things about you that you told no one. Lucky object: a fork you've been suspicious of since February."}]}
200
+ {"messages": [{"role": "user", "content": "Sign: Capricorn\nCategory: Career\nDate: 2026-04-15\nGenerate an unhinged horoscope."}, {"role": "assistant", "content": "Your boss will email you at 11:47pm. It will just say 'hmm'. Do not respond. Do not sleep. Just know."}]}
201
+ ```
202
+
203
+ ## Files in this repo
204
+
205
+ | File | Purpose |
206
+ |---|---|
207
+ | `adapter_config.json` | PEFT adapter configuration (rank, alpha, target modules) |
208
+ | `adapter_model.safetensors` | LoRA delta weights (~22MB) |
209
+ | Tokenizer files (if shipped) | Inherit from base — re-load from `meta-llama/Llama-3.2-1B-Instruct` if absent |
210
+
211
+ ## Related
212
+
213
+ - **Merged + Q4_K_M GGUF (run-ready):** [edbuildingstuff/unhinged-horoscopes](https://huggingface.co/edbuildingstuff/unhinged-horoscopes)
214
+ - **Reference Android app (Flutter + `llamadart`):** Unhinged Horoscopes — [Google Play](https://play.google.com/store/apps/details?id=ai.ertas.horoscope) / [horoscope.ertas.ai](https://horoscope.ertas.ai) (bundle id `ai.ertas.horoscope`)
215
+ - **Fine-tuning platform:** [Ertas.AI](https://www.ertas.ai)
216
+
217
+ ## License and credits
218
+
219
+ - Adapter weights: Apache-2.0 (downstream use must also comply with [Meta's Llama 3.2 community licence](https://www.llama.com/llama3_2/license/))
220
+ - Training dataset: MIT
221
+ - Fine-tuned with [Ertas.AI](https://www.ertas.ai), the managed fine-tuning platform that ran this LoRA on pre-configured GPUs end-to-end
222
+ - Built by Edward Yang ([edbuildingstuff](https://huggingface.co/edbuildingstuff)) as a reference POC for Ertas Product A: build your own on-device AI model and ship it inside your app. App live at [horoscope.ertas.ai](https://horoscope.ertas.ai) / [Google Play](https://play.google.com/store/apps/details?id=ai.ertas.horoscope).