Muiru commited on
Commit
ddc1dae
·
1 Parent(s): 6cc3ee7

docs: improve formatting and structure of readme file.

Browse files
Files changed (1) hide show
  1. README.hf.md +27 -26
README.hf.md CHANGED
@@ -30,11 +30,12 @@ model-index:
30
  name: Safety-aligned helpfulness
31
  ---
32
 
33
- ## CogniXpert-AI Model v1.0:
34
 
35
- Safety‑aware, non‑clinical conversational AI for supportive mental health and wellbeing use‑cases, built on Meta Llama 3.1 8B and fine‑tuned with LoRA. This repository contains the model configuration, tokenizer, generation defaults, and adapter metadata for efficient deployment.
36
 
37
- > Disclaimer: This project is intended for supportive, non‑clinical use. It does not replace care from licensed mental health professionals and does not provide diagnosis or treatment. If you are in crisis or may harm yourself or others, contact emergency services or your local suicide prevention hotline immediately.
 
38
 
39
  ![License](https://img.shields.io/badge/License-AGPL--3.0-blue)
40
  ![Model](https://img.shields.io/badge/Model-Llama_3.1_8B-green)
@@ -42,12 +43,12 @@ Safety‑aware, non‑clinical conversational AI for supportive mental health an
42
  ![Transformers](https://img.shields.io/badge/Transformers-4.47.1-purple)
43
  ![Unsloth](https://img.shields.io/badge/Unsloth-2024.9-teal)
44
 
45
- ## Research & Open Innovation for Mental Health
46
 
47
- We’re giving developers, researchers, academia, non‑profits, and mental health advocates the foundation tools to build better care through open‑source contribution.
48
  Foundational fine‑tuned model developed by CogniX LTD.
49
 
50
- ## Highlights
51
 
52
  - 8B Llama 3.1 backbone with long‑context (131k) support
53
  - 4‑bit quantization via BitsAndBytes for single‑GPU inference
@@ -55,17 +56,17 @@ Foundational fine‑tuned model developed by CogniX LTD.
55
  - Conversational alignment with supportive, coaching‑style responses
56
  - Ready for Python `transformers` + `unsloth` workflows
57
 
58
- ## Model Description
59
 
60
- CogniXpert v1.0 is a LoRA‑tuned variant of Llama 3.1 8B optimized for safe, empathetic conversation. The adapter focuses on key transformer projection modules, and default generation settings favor stable, coherent replies. Tokenizer configuration preserves the Llama 3 special tokens and right‑padding for batched inference.
61
 
62
- ## Dataset Sources
63
 
64
  - Native datasets: open mental health dialogue corpora curated for supportive conversation and coaching contexts.
65
  - Synthetic datasets: additional coaching‑style dialogues generated using OpenAI models to augment coverage and style diversity.
66
  - Fine‑tuning combined both native and synthetic sources with safety‑oriented filtering and prompt design.
67
 
68
- ## Model Details
69
 
70
  - Base model: `Meta Llama 3.1 8B`
71
  - Context length: `131,072`
@@ -75,14 +76,14 @@ CogniXpert v1.0 is a LoRA‑tuned variant of Llama 3.1 8B optimized for safe, em
75
  - Dtype: `float16`
76
  - Libraries: `transformers==4.47.1`, `unsloth==2024.9`, `peft`
77
 
78
- ## Generation Configuration
79
 
80
  - Temperature: `0.6`
81
  - Top‑p: `0.9`
82
  - Sampling: enabled
83
  - Max length: inherits long‑context defaults
84
 
85
- ## Quick Start
86
 
87
  ```python
88
  from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
@@ -102,7 +103,7 @@ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
102
  print(response)
103
  ```
104
 
105
- ## Streamlit Demo
106
 
107
  - Install dependencies: `pip install -U streamlit transformers peft bitsandbytes unsloth accelerate`
108
  - Run the app: `streamlit run app.py`
@@ -110,7 +111,7 @@ print(response)
110
 
111
  Alternatively: `pip install -r requirements.txt`
112
 
113
- ### Using the LoRA Adapter
114
 
115
  If you have the LoRA adapter weights (e.g., `adapter_model.bin`) for CogniXpert v1.0, you can attach them to the base model:
116
 
@@ -132,14 +133,14 @@ outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.6, top_p=0.
132
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
133
  ```
134
 
135
- ### Restoring Adapter Weights
136
 
137
  - Place `adapter_config.json` and either `adapter_model.safetensors` or `adapter_model.bin` in the project root (`c:/Users/Public/CogniXpert-Model-v1.0`).
138
  - The Streamlit demo auto‑attaches the adapter only when both config and weights are present; otherwise it runs base‑only and shows a warning.
139
 
140
- ## Chat Prompting:
141
 
142
- Llama 3 models expect structured headers and end‑of‑turn markers:
143
 
144
  ```text
145
  <|begin_of_text|><|start_header_id|>system<|end_header_id|>
@@ -151,20 +152,20 @@ I feel overwhelmed at work. Any suggestions?<|eot_id|>
151
 
152
  Terminate the assistant’s reply with `<|eot_id|>` when streaming multiple turns.
153
 
154
- ## Hardware & Performance
155
 
156
  - Runs on a single modern GPU with 4‑bit quantization; 16GB+ VRAM recommended
157
  - Up to 131k tokens context; long prompts require sufficient memory and batching care
158
  - Use `device_map="auto"` to distribute layers when available
159
 
160
- ## Safety, Scope, and Limitations
161
 
162
  - Intended for supportive conversation and coaching. It is not a medical device and does not provide diagnosis or treatment.
163
  - Encourages help‑seeking, evidence‑based coping strategies, and urgent resource guidance where appropriate.
164
  - May reflect biases present in training sources; review outputs before production use.
165
  - Avoid high‑risk clinical decision support without human oversight.
166
 
167
- ## Reproducibility (Unsloth + PEFT sketch)
168
 
169
  ```python
170
  # Pseudocode sketch of LoRA fine-tuning configuration
@@ -181,7 +182,7 @@ config = LoraConfig(
181
  # Save with: model.save_pretrained(ADAPTER_DIR) # produces adapter_model.bin + adapter_config.json
182
  ```
183
 
184
- ## Contribute
185
 
186
  - Improve safety alignment, prompting, and guardrails
187
  - Add evaluation scripts, probes, and benchmarks
@@ -192,7 +193,7 @@ config = LoraConfig(
192
 
193
  Read `CONTRIBUTING.md` to get started. Open issues for discussion and submit focused pull requests. Community standards are defined in `CODE_OF_CONDUCT.md`. For responsible disclosure, see `SECURITY.md`.
194
 
195
- ## Roadmap
196
 
197
  - Release reproducible training scripts and evaluation suite
198
  - Publish LoRA adapter weights with versioned artifacts
@@ -201,7 +202,7 @@ Read `CONTRIBUTING.md` to get started. Open issues for discussion and submit foc
201
  - Optimize inference for CPU and low‑VRAM devices
202
  - Add tutorials and notebooks for deployment and monitoring
203
 
204
- ## Optional Next Steps
205
 
206
  - Add CI with GitHub Actions for lint/type import and Streamlit smoke tests
207
  - Publish versioned releases and attach LoRA adapter artifacts
@@ -210,7 +211,7 @@ Read `CONTRIBUTING.md` to get started. Open issues for discussion and submit foc
210
  - Create a docs site (MkDocs/Docusaurus) with tutorials and API references
211
  - Add example notebooks for inference, alignment, and evaluation
212
 
213
- ## Acknowledgements
214
 
215
  - Foundational fine‑tuned model dev engineered by CogniX LTD.
216
  - Meta Llama 3.1 for the base architecture
@@ -218,6 +219,6 @@ Read `CONTRIBUTING.md` to get started. Open issues for discussion and submit foc
218
  - Open‑source contributors in safety‑aligned conversational AI
219
  - Libraries: `transformers`, `unsloth`, `peft`, `bitsandbytes`
220
 
221
- ## License
222
 
223
- This repository is licensed under `AGPL‑3.0`. The underlying base model (Meta Llama 3.1) is subject to Meta’s license; ensure compliance when distributing derivatives or weights.
 
30
  name: Safety-aligned helpfulness
31
  ---
32
 
33
+ ### CogniXpert-AI Model v1.0:
34
 
35
+ - Safety‑aware, non‑clinical conversational AI for supportive mental health and wellbeing use‑cases, built on Meta Llama 3.1 8B and fine‑tuned with LoRA. This repository contains the model configuration, tokenizer, generation defaults, and adapter metadata for efficient deployment.
36
 
37
+ #### Disclaimer:
38
+ - **Disclaimer:** This project is intended for supportive, non‑clinical use. It does not replace care from licensed mental health professionals and does not provide diagnosis or treatment. If you are in crisis or may harm yourself or others, contact emergency services or your local suicide prevention hotline immediately.
39
 
40
  ![License](https://img.shields.io/badge/License-AGPL--3.0-blue)
41
  ![Model](https://img.shields.io/badge/Model-Llama_3.1_8B-green)
 
43
  ![Transformers](https://img.shields.io/badge/Transformers-4.47.1-purple)
44
  ![Unsloth](https://img.shields.io/badge/Unsloth-2024.9-teal)
45
 
46
+ ### Research & Open Innovation for Mental Health:
47
 
48
+ - We’re giving developers, researchers, academia, non‑profits, and mental health advocates the foundation tools to build better care through open‑source contribution.
49
  Foundational fine‑tuned model developed by CogniX LTD.
50
 
51
+ ### Highlights:
52
 
53
  - 8B Llama 3.1 backbone with long‑context (131k) support
54
  - 4‑bit quantization via BitsAndBytes for single‑GPU inference
 
56
  - Conversational alignment with supportive, coaching‑style responses
57
  - Ready for Python `transformers` + `unsloth` workflows
58
 
59
+ ### Model Description:
60
 
61
+ - CogniXpert v1.0 is a LoRA‑tuned variant of Llama 3.1 8B optimized for safe, empathetic conversation. The adapter focuses on key transformer projection modules, and default generation settings favor stable, coherent replies. Tokenizer configuration preserves the Llama 3 special tokens and right‑padding for batched inference.
62
 
63
+ ### Dataset Sources:
64
 
65
  - Native datasets: open mental health dialogue corpora curated for supportive conversation and coaching contexts.
66
  - Synthetic datasets: additional coaching‑style dialogues generated using OpenAI models to augment coverage and style diversity.
67
  - Fine‑tuning combined both native and synthetic sources with safety‑oriented filtering and prompt design.
68
 
69
+ ### Model Details:
70
 
71
  - Base model: `Meta Llama 3.1 8B`
72
  - Context length: `131,072`
 
76
  - Dtype: `float16`
77
  - Libraries: `transformers==4.47.1`, `unsloth==2024.9`, `peft`
78
 
79
+ ### Generation Configuration:
80
 
81
  - Temperature: `0.6`
82
  - Top‑p: `0.9`
83
  - Sampling: enabled
84
  - Max length: inherits long‑context defaults
85
 
86
+ ### Quick Start:
87
 
88
  ```python
89
  from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
 
103
  print(response)
104
  ```
105
 
106
+ ### Streamlit Demo:
107
 
108
  - Install dependencies: `pip install -U streamlit transformers peft bitsandbytes unsloth accelerate`
109
  - Run the app: `streamlit run app.py`
 
111
 
112
  Alternatively: `pip install -r requirements.txt`
113
 
114
+ #### Using the LoRA Adapter:
115
 
116
  If you have the LoRA adapter weights (e.g., `adapter_model.bin`) for CogniXpert v1.0, you can attach them to the base model:
117
 
 
133
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
134
  ```
135
 
136
+ #### Restoring Adapter Weights
137
 
138
  - Place `adapter_config.json` and either `adapter_model.safetensors` or `adapter_model.bin` in the project root (`c:/Users/Public/CogniXpert-Model-v1.0`).
139
  - The Streamlit demo auto‑attaches the adapter only when both config and weights are present; otherwise it runs base‑only and shows a warning.
140
 
141
+ ### Chat Prompting:
142
 
143
+ - Llama 3 models expect structured headers and end‑of‑turn markers:
144
 
145
  ```text
146
  <|begin_of_text|><|start_header_id|>system<|end_header_id|>
 
152
 
153
  Terminate the assistant’s reply with `<|eot_id|>` when streaming multiple turns.
154
 
155
+ ### Hardware & Performance:
156
 
157
  - Runs on a single modern GPU with 4‑bit quantization; 16GB+ VRAM recommended
158
  - Up to 131k tokens context; long prompts require sufficient memory and batching care
159
  - Use `device_map="auto"` to distribute layers when available
160
 
161
+ ### Safety, Scope, and Limitations:
162
 
163
  - Intended for supportive conversation and coaching. It is not a medical device and does not provide diagnosis or treatment.
164
  - Encourages help‑seeking, evidence‑based coping strategies, and urgent resource guidance where appropriate.
165
  - May reflect biases present in training sources; review outputs before production use.
166
  - Avoid high‑risk clinical decision support without human oversight.
167
 
168
+ ### Reproducibility (Unsloth + PEFT sketch):
169
 
170
  ```python
171
  # Pseudocode sketch of LoRA fine-tuning configuration
 
182
  # Save with: model.save_pretrained(ADAPTER_DIR) # produces adapter_model.bin + adapter_config.json
183
  ```
184
 
185
+ ### Contribute:
186
 
187
  - Improve safety alignment, prompting, and guardrails
188
  - Add evaluation scripts, probes, and benchmarks
 
193
 
194
  Read `CONTRIBUTING.md` to get started. Open issues for discussion and submit focused pull requests. Community standards are defined in `CODE_OF_CONDUCT.md`. For responsible disclosure, see `SECURITY.md`.
195
 
196
+ ### Roadmap:
197
 
198
  - Release reproducible training scripts and evaluation suite
199
  - Publish LoRA adapter weights with versioned artifacts
 
202
  - Optimize inference for CPU and low‑VRAM devices
203
  - Add tutorials and notebooks for deployment and monitoring
204
 
205
+ ### Optional Next Steps:
206
 
207
  - Add CI with GitHub Actions for lint/type import and Streamlit smoke tests
208
  - Publish versioned releases and attach LoRA adapter artifacts
 
211
  - Create a docs site (MkDocs/Docusaurus) with tutorials and API references
212
  - Add example notebooks for inference, alignment, and evaluation
213
 
214
+ ### Acknowledgements:
215
 
216
  - Foundational fine‑tuned model dev engineered by CogniX LTD.
217
  - Meta Llama 3.1 for the base architecture
 
219
  - Open‑source contributors in safety‑aligned conversational AI
220
  - Libraries: `transformers`, `unsloth`, `peft`, `bitsandbytes`
221
 
222
+ ### License:
223
 
224
+ - This repository is licensed under `AGPL‑3.0`. The underlying base model (Meta Llama 3.1) is subject to Meta’s license; ensure compliance when distributing derivatives or weights.