chore: rename project from CogniXpert-Model-v1.0 to Cogni-OpenModel
Browse files- Update all references in README.md, app.py, CONTRIBUTING.md, CODE_OF_CONDUCT.md
- Update LOCAL_DIR paths, page titles, system prompts, and headings
- Also update CONTRIBUTING.md license reference from AGPL-3.0 to MIT
- CODE_OF_CONDUCT.md +2 -2
- CONTRIBUTING.md +3 -3
- README.md +7 -7
- app.py +5 -5
CODE_OF_CONDUCT.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
# Contributor Covenant Code of Conduct
|
| 2 |
|
| 3 |
## Our Pledge
|
| 4 |
|
| 5 |
-
We pledge to make participation in
|
| 6 |
|
| 7 |
## Our Standards
|
| 8 |
|
|
|
|
| 1 |
+
# Contributor Covenant Code of Conduct
|
| 2 |
|
| 3 |
## Our Pledge
|
| 4 |
|
| 5 |
+
We pledge to make participation in Cogni-OpenModel a harassment‑free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
| 6 |
|
| 7 |
## Our Standards
|
| 8 |
|
CONTRIBUTING.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
# Contributing to
|
| 2 |
|
| 3 |
-
Thanks for your interest in improving
|
| 4 |
|
| 5 |
## Ways to Contribute
|
| 6 |
|
|
@@ -53,5 +53,5 @@ Thanks for your interest in improving CogniXpert. Contributions of code, docs, e
|
|
| 53 |
|
| 54 |
## License
|
| 55 |
|
| 56 |
-
By contributing, you agree your contributions are licensed under
|
| 57 |
|
|
|
|
| 1 |
+
# Contributing to Cogni-OpenModel
|
| 2 |
|
| 3 |
+
Thanks for your interest in improving Cogni-OpenModel. Contributions of code, docs, evaluations, and safety improvements are welcome.
|
| 4 |
|
| 5 |
## Ways to Contribute
|
| 6 |
|
|
|
|
| 53 |
|
| 54 |
## License
|
| 55 |
|
| 56 |
+
By contributing, you agree your contributions are licensed under MIT.
|
| 57 |
|
README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
###
|
| 2 |
|
| 3 |
- 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.
|
| 4 |
|
|
@@ -27,7 +27,7 @@ Foundational fine‑tuned model developed by CogniX LTD.
|
|
| 27 |
|
| 28 |
### Model Description:
|
| 29 |
|
| 30 |
-
-
|
| 31 |
|
| 32 |
### Dataset Sources:
|
| 33 |
|
|
@@ -60,7 +60,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
|
| 60 |
|
| 61 |
# Base-only inference (loads Unsloth 4-bit backbone)
|
| 62 |
MODEL_ID = "unsloth/meta-llama-3.1-8b-bnb-4bit"
|
| 63 |
-
LOCAL_DIR = "c:/Users/Public/
|
| 64 |
|
| 65 |
tokenizer = AutoTokenizer.from_pretrained(LOCAL_DIR)
|
| 66 |
model = AutoModelForCausalLM.from_pretrained(MODEL_ID, device_map="auto")
|
|
@@ -83,14 +83,14 @@ Alternatively: `pip install -r requirements.txt`
|
|
| 83 |
|
| 84 |
### Using the LoRA Adapter:
|
| 85 |
|
| 86 |
-
- If you have the LoRA adapter weights (e.g., `adapter_model.bin`) for
|
| 87 |
|
| 88 |
```python
|
| 89 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 90 |
from peft import PeftModel
|
| 91 |
|
| 92 |
BASE_ID = "unsloth/meta-llama-3.1-8b-bnb-4bit"
|
| 93 |
-
LOCAL_DIR = "c:/Users/Public/
|
| 94 |
ADAPTER_DIR = LOCAL_DIR # place adapter weights here (adapter_model.bin)
|
| 95 |
|
| 96 |
tokenizer = AutoTokenizer.from_pretrained(LOCAL_DIR)
|
|
@@ -105,7 +105,7 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 105 |
|
| 106 |
### Restoring Adapter Weights:
|
| 107 |
|
| 108 |
-
- Place `adapter_config.json` and either `adapter_model.safetensors` or `adapter_model.bin` in the project root (`c:/Users/Public/
|
| 109 |
- The Streamlit demo auto‑attaches the adapter only when both config and weights are present; otherwise it runs base‑only and shows a warning.
|
| 110 |
|
| 111 |
### Chat Prompting:
|
|
@@ -114,7 +114,7 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 114 |
|
| 115 |
```text
|
| 116 |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
| 117 |
-
You are
|
| 118 |
<|start_header_id|>user<|end_header_id|>
|
| 119 |
I feel overwhelmed at work. Any suggestions?<|eot_id|>
|
| 120 |
<|start_header_id|>assistant<|end_header_id|>
|
|
|
|
| 1 |
+
### Cogni-OpenModel:
|
| 2 |
|
| 3 |
- 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.
|
| 4 |
|
|
|
|
| 27 |
|
| 28 |
### Model Description:
|
| 29 |
|
| 30 |
+
- Cogni-OpenModel 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.
|
| 31 |
|
| 32 |
### Dataset Sources:
|
| 33 |
|
|
|
|
| 60 |
|
| 61 |
# Base-only inference (loads Unsloth 4-bit backbone)
|
| 62 |
MODEL_ID = "unsloth/meta-llama-3.1-8b-bnb-4bit"
|
| 63 |
+
LOCAL_DIR = "c:/Users/Public/Cogni-OpenModel"
|
| 64 |
|
| 65 |
tokenizer = AutoTokenizer.from_pretrained(LOCAL_DIR)
|
| 66 |
model = AutoModelForCausalLM.from_pretrained(MODEL_ID, device_map="auto")
|
|
|
|
| 83 |
|
| 84 |
### Using the LoRA Adapter:
|
| 85 |
|
| 86 |
+
- If you have the LoRA adapter weights (e.g., `adapter_model.bin`) for Cogni-OpenModel, you can attach them to the base model:
|
| 87 |
|
| 88 |
```python
|
| 89 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 90 |
from peft import PeftModel
|
| 91 |
|
| 92 |
BASE_ID = "unsloth/meta-llama-3.1-8b-bnb-4bit"
|
| 93 |
+
LOCAL_DIR = "c:/Users/Public/Cogni-OpenModel" # contains adapter_config.json
|
| 94 |
ADAPTER_DIR = LOCAL_DIR # place adapter weights here (adapter_model.bin)
|
| 95 |
|
| 96 |
tokenizer = AutoTokenizer.from_pretrained(LOCAL_DIR)
|
|
|
|
| 105 |
|
| 106 |
### Restoring Adapter Weights:
|
| 107 |
|
| 108 |
+
- Place `adapter_config.json` and either `adapter_model.safetensors` or `adapter_model.bin` in the project root (`c:/Users/Public/Cogni-OpenModel`).
|
| 109 |
- The Streamlit demo auto‑attaches the adapter only when both config and weights are present; otherwise it runs base‑only and shows a warning.
|
| 110 |
|
| 111 |
### Chat Prompting:
|
|
|
|
| 114 |
|
| 115 |
```text
|
| 116 |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
| 117 |
+
You are Cogni-OpenModel, a supportive, safety-aware assistant.<|eot_id|>
|
| 118 |
<|start_header_id|>user<|end_header_id|>
|
| 119 |
I feel overwhelmed at work. Any suggestions?<|eot_id|>
|
| 120 |
<|start_header_id|>assistant<|end_header_id|>
|
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
import os
|
| 2 |
import streamlit as st
|
| 3 |
import torch
|
| 4 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 5 |
from peft import PeftModel
|
| 6 |
|
| 7 |
-
LOCAL_DIR = "c:/Users/Public/
|
| 8 |
BASE_ID = "unsloth/meta-llama-3.1-8b-bnb-4bit"
|
| 9 |
|
| 10 |
@st.cache_resource
|
|
@@ -33,12 +33,12 @@ def format_prompt(system_text: str, messages: list[str]):
|
|
| 33 |
content += "<|start_header_id|>assistant<|end_header_id|>\n"
|
| 34 |
return content
|
| 35 |
|
| 36 |
-
st.set_page_config(page_title="
|
| 37 |
|
| 38 |
if "messages" not in st.session_state:
|
| 39 |
st.session_state.messages = []
|
| 40 |
|
| 41 |
-
st.title("
|
| 42 |
st.caption("Supportive, safety‑aware conversational AI. Not medical advice.")
|
| 43 |
|
| 44 |
use_adapter = st.sidebar.checkbox("Use LoRA adapter if available", value=True)
|
|
@@ -46,7 +46,7 @@ temperature = st.sidebar.slider("Temperature", 0.0, 1.5, 0.6, 0.05)
|
|
| 46 |
top_p = st.sidebar.slider("Top‑p", 0.1, 1.0, 0.9, 0.05)
|
| 47 |
max_new_tokens = st.sidebar.slider("Max new tokens", 32, 1024, 256, 32)
|
| 48 |
|
| 49 |
-
system_default = "You are
|
| 50 |
system_text = st.text_area("System prompt", value=system_default, height=100)
|
| 51 |
|
| 52 |
tok, model = load_model(use_adapter)
|
|
|
|
| 1 |
+
import os
|
| 2 |
import streamlit as st
|
| 3 |
import torch
|
| 4 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 5 |
from peft import PeftModel
|
| 6 |
|
| 7 |
+
LOCAL_DIR = "c:/Users/Public/Cogni-OpenModel"
|
| 8 |
BASE_ID = "unsloth/meta-llama-3.1-8b-bnb-4bit"
|
| 9 |
|
| 10 |
@st.cache_resource
|
|
|
|
| 33 |
content += "<|start_header_id|>assistant<|end_header_id|>\n"
|
| 34 |
return content
|
| 35 |
|
| 36 |
+
st.set_page_config(page_title="Cogni-OpenModel Chat", page_icon="🧠", layout="centered")
|
| 37 |
|
| 38 |
if "messages" not in st.session_state:
|
| 39 |
st.session_state.messages = []
|
| 40 |
|
| 41 |
+
st.title("Cogni-OpenModel Chat")
|
| 42 |
st.caption("Supportive, safety‑aware conversational AI. Not medical advice.")
|
| 43 |
|
| 44 |
use_adapter = st.sidebar.checkbox("Use LoRA adapter if available", value=True)
|
|
|
|
| 46 |
top_p = st.sidebar.slider("Top‑p", 0.1, 1.0, 0.9, 0.05)
|
| 47 |
max_new_tokens = st.sidebar.slider("Max new tokens", 32, 1024, 256, 32)
|
| 48 |
|
| 49 |
+
system_default = "You are Cogni-OpenModel, a supportive, safety‑aware assistant. Encourage help‑seeking and evidence‑based coping strategies. Avoid clinical diagnosis or prescriptive treatment."
|
| 50 |
system_text = st.text_area("System prompt", value=system_default, height=100)
|
| 51 |
|
| 52 |
tok, model = load_model(use_adapter)
|