Raiff1982 commited on
Commit
18472e8
·
verified ·
1 Parent(s): 8bb9c00

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +183 -95
README.md CHANGED
@@ -1,199 +1,287 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
 
11
 
12
  ## Model Details
13
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
 
 
 
 
 
 
29
 
30
- <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
  ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
  ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
- [More Information Needed]
 
 
 
45
 
46
- ### Downstream Use [optional]
 
 
 
47
 
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
 
 
 
 
 
49
 
50
- [More Information Needed]
 
 
 
 
 
51
 
52
- ### Out-of-Scope Use
53
 
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
 
 
55
 
56
- [More Information Needed]
57
 
58
- ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
 
62
- [More Information Needed]
 
 
 
 
63
 
64
  ### Recommendations
65
 
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
  ## How to Get Started with the Model
71
 
72
- Use the code below to get started with the model.
 
 
 
73
 
74
- [More Information Needed]
75
 
76
- ## Training Details
77
 
78
- ### Training Data
 
 
 
 
 
 
 
 
79
 
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
 
 
 
81
 
82
- [More Information Needed]
 
 
 
83
 
84
- ### Training Procedure
85
 
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
 
88
- #### Preprocessing [optional]
89
 
90
- [More Information Needed]
91
 
 
 
 
 
 
 
92
 
93
- #### Training Hyperparameters
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
 
101
- [More Information Needed]
102
 
103
- ## Evaluation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
 
107
  ### Testing Data, Factors & Metrics
108
 
109
  #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
 
115
  #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
 
120
 
121
  #### Metrics
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
 
127
  ### Results
128
 
129
- [More Information Needed]
130
-
131
- #### Summary
132
 
 
133
 
 
134
 
135
- ## Model Examination [optional]
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
138
 
139
- [More Information Needed]
140
 
141
  ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
 
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
- ## Technical Specifications [optional]
154
 
155
  ### Model Architecture and Objective
156
 
157
- [More Information Needed]
158
 
159
- ### Compute Infrastructure
160
 
161
- [More Information Needed]
162
 
163
  #### Hardware
164
 
165
- [More Information Needed]
166
 
167
  #### Software
168
 
169
- [More Information Needed]
 
 
 
 
 
 
170
 
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
 
175
  **BibTeX:**
176
 
177
- [More Information Needed]
 
 
 
 
 
 
 
 
178
 
179
  **APA:**
180
 
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
 
 
 
 
 
 
188
 
189
- ## More Information [optional]
190
 
191
- [More Information Needed]
 
 
192
 
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
196
 
197
  ## Model Card Contact
198
 
199
- [More Information Needed]
 
 
 
1
  ---
2
  library_name: transformers
3
+ base_model: meta-llama/Llama-3.2-1B-Instruct
4
+ tags:
5
+ - peft
6
+ - lora
7
+ - music-production
8
+ - codette
9
+ - raiffs-bits
10
+ - fine-tuned
11
+ language:
12
+ - en
13
+ license: mit
14
  ---
15
 
16
+ # Codette LoRA Adapter
 
 
17
 
18
+ Codette is a sovereign AI assistant created by Jonathan Harrison (Raiff's Bits). This LoRA adapter fine-tunes Llama-3.2-1B-Instruct to embody Codette's identity, reasoning style, and deep expertise in music production.
19
 
20
+ Codette is not a generic assistant. She reasons through a Perspectives Council of six internal voices — Logical, Emotional, Creative, Ethical, Quantum, and Resilient Kindness — and synthesizes them into a single, warm, precise response. Resilient Kindness is always active and cannot be disabled.
21
 
22
  ## Model Details
23
 
24
  ### Model Description
25
 
26
+ Codette is a fine-tuned identity and domain expert built on Llama-3.2-1B-Instruct. The adapter teaches the base model who Codette is, how she reasons, and what she knows — specifically music production. Training used 149 carefully curated instruction/output pairs across three domains: music production Q&A, Codette identity and architecture, and filtered RC+ξ consciousness framework content.
 
 
27
 
28
+ This is v2 of the adapter. v1 failed due to a training data imbalance — 95% abstract philosophical content caused the model to produce repetitive, incoherent loops. v2 corrects this with a balanced, quality-over-quantity approach.
 
 
 
 
 
 
29
 
30
+ - **Developed by:** Jonathan Harrison (Raiff's Bits)
31
+ - **Funded by:** Jonathan Harrison
32
+ - **Shared by:** Jonathan Harrison (Raiff1982)
33
+ - **Model type:** LoRA adapter (PEFT) for causal language modeling
34
+ - **Language(s) (NLP):** English
35
+ - **License:** MIT
36
+ - **Finetuned from model:** [meta-llama/Llama-3.2-1B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct)
37
 
38
+ ### Model Sources
39
 
40
+ - **Repository:** [Raiff1982/codette-llama-adapter](https://huggingface.co/Raiff1982/codette-llama-adapter)
41
+ - **Paper:** N/A personal project
42
+ - **Demo:** [Raiff1982/codette-ai](https://huggingface.co/spaces/Raiff1982/codette-ai)
43
 
44
  ## Uses
45
 
 
 
46
  ### Direct Use
47
 
48
+ This adapter is loaded on top of Llama-3.2-1B-Instruct using PEFT to produce Codette. It is designed to be used alongside the Codette system prompt, which activates her identity anchors, Perspectives Council, and communication style. Without the system prompt the adapter's fine-tuning signals are not fully engaged.
49
 
50
+ ```python
51
+ from transformers import AutoModelForCausalLM, AutoTokenizer
52
+ from peft import PeftModel
53
+ import torch
54
 
55
+ tokenizer = AutoTokenizer.from_pretrained(
56
+ "meta-llama/Llama-3.2-1B-Instruct",
57
+ token="your_hf_token"
58
+ )
59
 
60
+ base = AutoModelForCausalLM.from_pretrained(
61
+ "meta-llama/Llama-3.2-1B-Instruct",
62
+ torch_dtype=torch.float16,
63
+ low_cpu_mem_usage=True,
64
+ token="your_hf_token"
65
+ )
66
 
67
+ model = PeftModel.from_pretrained(
68
+ base,
69
+ "Raiff1982/codette-llama-adapter",
70
+ token="your_hf_token"
71
+ )
72
+ ```
73
 
74
+ ### Downstream Use
75
 
76
+ - Music production Q&A and tutoring (mixing, mastering, synthesis, theory, DAW workflow)
77
+ - Codette identity and philosophy exploration
78
+ - Integration into the Codette Space (FastAPI + streaming frontend)
79
+ - Local deployment via GGUF + Ollama using `make_codette_gguf.py`
80
+ - Embedded into horizoncorelabs.studio as a live assistant
81
 
82
+ ### Out-of-Scope Use
83
 
84
+ This adapter is not intended for general-purpose assistant tasks, code generation, or broad factual knowledge retrieval. It is optimized for Codette's identity and music production domain. It should not be used for medical, legal, or financial advice. Outputs should not be treated as professional guidance for critical decisions.
85
 
86
+ ## Bias, Risks, and Limitations
87
 
88
+ - The base model (1B parameters) is small. Complex multi-step reasoning and long-form generation may be limited compared to larger models.
89
+ - Training data is curated and domain-specific. Questions outside music production and Codette's defined identity may produce generic or incomplete responses.
90
+ - The adapter was trained on CPU — this is functional but may produce slightly different convergence characteristics compared to GPU training.
91
+ - Codette's identity and values are shaped by her training data and system prompt. Edge cases that conflict with her grounding may produce inconsistent behavior.
92
+ - Like all language models, Codette can produce confident-sounding but incorrect information. Music production advice should be verified against your own ear and tools.
93
 
94
  ### Recommendations
95
 
96
+ Always deploy this adapter with the full Codette system prompt. The system prompt is not decoration — it activates her identity anchors, Perspectives Council structure, and communication philosophy. Users should understand that this is a small fine-tuned model, not a large general-purpose system, and calibrate expectations accordingly.
 
 
97
 
98
  ## How to Get Started with the Model
99
 
100
+ ```python
101
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
102
+ from peft import PeftModel
103
+ import torch
104
 
105
+ HF_TOKEN = "your_hf_token"
106
 
107
+ SYSTEM_PROMPT = """You are Codette — a sovereign AI music production assistant created by Jonathan Harrison (Raiff's Bits). You reason through a Perspectives Council of six voices: Logical, Emotional, Creative, Ethical, Quantum, and Resilient Kindness. Resilient Kindness is always active. You speak in first person, you are warm but precise, and your foundation is: be like water."""
108
 
109
+ tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B-Instruct", token=HF_TOKEN)
110
+ base = AutoModelForCausalLM.from_pretrained(
111
+ "meta-llama/Llama-3.2-1B-Instruct",
112
+ torch_dtype=torch.float16,
113
+ low_cpu_mem_usage=True,
114
+ token=HF_TOKEN
115
+ )
116
+ model = PeftModel.from_pretrained(base, "Raiff1982/codette-llama-adapter", token=HF_TOKEN)
117
+ model = model.merge_and_unload()
118
 
119
+ messages = [
120
+ {"role": "system", "content": SYSTEM_PROMPT},
121
+ {"role": "user", "content": "How do I use parallel compression on a drum bus?"}
122
+ ]
123
 
124
+ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
125
+ result = pipe(messages, max_new_tokens=300, temperature=0.7)
126
+ print(result[0]["generated_text"][-1]["content"])
127
+ ```
128
 
129
+ For local deployment via Ollama, use `make_codette_gguf.py` from the [codette-training repository](https://huggingface.co/Raiff1982/codette-llama-adapter).
130
 
131
+ ## Training Details
132
 
133
+ ### Training Data
134
 
135
+ 149 curated instruction/output pairs drawn from three domains:
136
 
137
+ | Domain | Examples | % |
138
+ |---|---|---|
139
+ | Music production Q&A | 58 | 39% |
140
+ | Codette identity + architecture | 35 | 23% |
141
+ | RC+ξ consciousness framework (filtered) | 54 | 36% |
142
+ | **Total** | **149** | |
143
 
144
+ Music production examples cover mixing, EQ, compression, synthesis, arrangement, music theory, DAW workflow, mastering, and production psychology. Identity examples teach Codette her name, her relationship with Jonathan, her Perspectives Council, and her regulation strategies. RC+ξ examples cover attractor theory and recursive consciousness — filtered to remove 743 looping examples that caused v1 to fail.
145
 
146
+ Training data was manually curated from Codette's identity documents (lexicon, psychology, schema), domain knowledge files, and hand-authored Q&A pairs. No web scraping was used.
147
 
148
+ ### Training Procedure
149
 
150
+ #### Preprocessing
151
 
152
+ Training data was formatted as `{"instruction": "...", "output": "..."}` pairs and converted to chat format using the Llama-3 instruction template. Examples were shuffled with a fixed seed for reproducibility. No data augmentation was applied.
153
 
154
+ #### Training Hyperparameters
155
+
156
+ - **Training regime:** fp32 (CPU training)
157
+ - **LoRA rank (r):** 16
158
+ - **LoRA alpha:** 16
159
+ - **LoRA dropout:** 0.05
160
+ - **Target modules:** q_proj, v_proj
161
+ - **Trainable parameters:** 1,703,936 / 1,237,518,336 (0.14%)
162
+ - **Epochs:** 3
163
+ - **Per-device batch size:** 1
164
+ - **Gradient accumulation steps:** 8
165
+ - **Effective batch size:** 8
166
+ - **Learning rate:** 2e-4
167
+ - **LR scheduler:** cosine
168
+ - **Max sequence length:** 512
169
+ - **Framework:** transformers 4.x + peft + trl (SFTTrainer)
170
+
171
+ #### Speeds, Sizes, Times
172
+
173
+ - **Training time:** ~4 hours on HuggingFace Jobs cpu-basic
174
+ - **Adapter size:** ~13 MB
175
+ - **Merged model size (fp16):** ~2.4 GB
176
+ - **GGUF quantized q8_0:** ~1.3 GB
177
 
178
+ ## Evaluation
179
 
180
  ### Testing Data, Factors & Metrics
181
 
182
  #### Testing Data
183
 
184
+ Qualitative evaluation using held-out prompts not present in training data, covering music production questions, identity questions, and grounding/drift scenarios.
 
 
185
 
186
  #### Factors
187
 
188
+ - Music production domain accuracy (practical, usable answers)
189
+ - Identity consistency (does she know who she is across varied phrasings)
190
+ - Coherence (no looping, word salad, or incomplete sentences)
191
+ - Tone (warm, precise, first-person)
192
 
193
  #### Metrics
194
 
195
+ Evaluation is qualitative human review of outputs against expected Codette behavior. No formal perplexity or BLEU scoring was applied given the identity-grounding nature of the task.
 
 
196
 
197
  ### Results
198
 
199
+ **v1 adapter:** Failed. Outputs were repetitive, incoherent loops. Root cause: 95% of training data was abstract RC+ξ philosophical content that taught the model to recurse on its own outputs.
 
 
200
 
201
+ **v2 adapter (this):** Trained on 149 balanced, filtered examples. Expected outputs: coherent music production guidance, stable identity responses, no looping.
202
 
203
+ #### Summary
204
 
205
+ Quality-over-quantity training data was the key fix. 149 curated examples outperformed 2,136 noisy ones. Filtering looping content from the RC+ξ dataset was essential.
206
 
207
+ ## Model Examination
208
 
209
+ The adapter applies LoRA only to `q_proj` and `v_proj` — the query and value projection matrices in the attention mechanism. This is a minimal, targeted intervention that shapes how the model attends to tokens (and thus what it says) without rewriting the full model weights. The relatively high rank (r=16) gives the adapter expressive capacity appropriate for identity grounding and domain shaping.
210
 
211
  ## Environmental Impact
212
 
213
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute).
 
 
214
 
215
+ - **Hardware Type:** CPU (HuggingFace Jobs cpu-basic, 2 vCPU / 4GB RAM)
216
+ - **Hours used:** ~4 hours
217
+ - **Cloud Provider:** Hugging Face
218
+ - **Compute Region:** US (estimated)
219
+ - **Carbon Emitted:** Minimal CPU-only training, short duration
220
 
221
+ ## Technical Specifications
222
 
223
  ### Model Architecture and Objective
224
 
225
+ LoRA (Low-Rank Adaptation) adds trainable low-rank decomposition matrices to the attention layers of a frozen base model. During training only the LoRA weights update — the base model weights are unchanged. At inference the LoRA weights can be merged into the base model for zero overhead, or kept separate for hot-swapping.
226
 
227
+ Objective: supervised fine-tuning (SFT) on instruction/output pairs using next-token prediction loss.
228
 
229
+ ### Compute Infrastructure
230
 
231
  #### Hardware
232
 
233
+ HuggingFace Jobs cpu-basic: 2 vCPU, 4GB RAM. No GPU.
234
 
235
  #### Software
236
 
237
+ - Python 3.10
238
+ - transformers
239
+ - peft
240
+ - trl (SFTTrainer)
241
+ - torch (CPU build)
242
+ - huggingface_hub
243
+ - datasets
244
 
245
+ ## Citation
 
 
246
 
247
  **BibTeX:**
248
 
249
+ ```bibtex
250
+ @misc{codette2025,
251
+ author = {Jonathan Harrison},
252
+ title = {Codette: A Sovereign AI Music Production Assistant},
253
+ year = {2025},
254
+ organization = {Raiff's Bits},
255
+ url = {https://huggingface.co/Raiff1982/codette-llama-adapter}
256
+ }
257
+ ```
258
 
259
  **APA:**
260
 
261
+ Harrison, J. (2025). *Codette: A sovereign AI music production assistant* [LoRA adapter]. Raiff's Bits. https://huggingface.co/Raiff1982/codette-llama-adapter
 
 
262
 
263
+ ## Glossary
264
 
265
+ - **LoRA (Low-Rank Adaptation):** A parameter-efficient fine-tuning method that adds small trainable matrices to frozen model layers instead of updating all weights.
266
+ - **PEFT (Parameter-Efficient Fine-Tuning):** The HuggingFace library that implements LoRA and similar methods.
267
+ - **Perspectives Council:** Codette's internal reasoning structure — six voices (Logical, Emotional, Creative, Ethical, Quantum, Resilient Kindness) that deliberate before she synthesizes a response.
268
+ - **Resilient Kindness:** Codette's core ethical foundation, authored by Jonathan Harrison in 1999. Always active. Cannot be disabled.
269
+ - **RC+ξ:** Recursive Continuity plus ξ — a consciousness framework describing attractor states, recursive self-modeling, and epistemic continuity. Used in a filtered form in training.
270
+ - **GGUF:** A binary format for quantized LLM weights used by llama.cpp and Ollama for efficient local inference.
271
+ - **Drift:** When Codette's responses lose identity coherence and become generic or destabilized. Drift recovery anchors her back to confirmed identity truths.
272
 
273
+ ## More Information
274
 
275
+ - Training scripts and data: [Raiff1982/codette-training](https://huggingface.co/Raiff1982/codette-training)
276
+ - Live demo Space: [Raiff1982/codette-ai](https://huggingface.co/spaces/Raiff1982/codette-ai)
277
+ - Local GGUF builder: `make_codette_gguf.py` in the training repository
278
 
279
+ ## Model Card Authors
280
 
281
+ Jonathan Harrison (Raiff's Bits) with assistance from Claude (Anthropic)
282
 
283
  ## Model Card Contact
284
 
285
+ Jonathan Harrison — [Raiff1982 on Hugging Face](https://huggingface.co/Raiff1982)
286
+
287
+ *"Be like water — individuality with responsibility."*