basiphobe commited on
Commit
d5b9d51
·
verified ·
1 Parent(s): d3baeee

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: teknium/OpenHermes-2.5-Mistral-7B
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:teknium/OpenHermes-2.5-Mistral-7B
7
+ - lora
8
+ - medical
9
+ - spinal-cord-injury
10
+ - healthcare
11
+ - assistant
12
+ ---
13
+
14
+ # SCI Assistant - Spinal Cord Injury Specialized AI Assistant
15
+ A specialized AI assistant fine-tuned specifically for people with spinal cord injuries (SCI). This model is based on OpenHermes-2.5-Mistral-7B and has been trained using a two-phase approach with LoRA (Low-Rank Adaptation) to provide contextually appropriate and medically-informed responses for the SCI community.
16
+
17
+ ## Model Description
18
+
19
+ This model was fine-tuned using a two-phase training approach:
20
+ 1. **Phase 1**: Domain pretraining on SCI-related medical texts and resources
21
+ 2. **Phase 2**: Instruction tuning on conversational SCI-focused Q&A pairs
22
+
23
+ The model understands the unique challenges, medical realities, and daily life considerations of individuals living with spinal cord injuries.
24
+
25
+ ## Training Details
26
+
27
+ - **Base Model**: teknium/OpenHermes-2.5-Mistral-7B
28
+ - **Training Method**: QLoRA (4-bit quantization with LoRA adapters)
29
+ - **Training Data**: 119,117 total entries (35,779 domain text + 83,337 instruction pairs)
30
+ - **Hardware**: RTX 4070 Super (8GB VRAM)
31
+ - **Training Time**: ~20 hours total (Phase 1 + Phase 2)
32
+
33
+ ## Usage
34
+
35
+ ```python
36
+ from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
37
+ from peft import PeftModel
38
+ import torch
39
+
40
+ # Load model
41
+ bnb_config = BitsAndBytesConfig(
42
+ load_in_4bit=True,
43
+ bnb_4bit_compute_dtype=torch.float16,
44
+ )
45
+
46
+ base_model = AutoModelForCausalLM.from_pretrained(
47
+ "teknium/OpenHermes-2.5-Mistral-7B",
48
+ quantization_config=bnb_config,
49
+ device_map="auto"
50
+ )
51
+
52
+ model = PeftModel.from_pretrained(base_model, "basiphobe/sci-assistant")
53
+ tokenizer = AutoTokenizer.from_pretrained("basiphobe/sci-assistant")
54
+
55
+ # Format prompt with SCI context
56
+ system_context = "You are a specialized medical assistant for people with spinal cord injuries. Your responses should always consider the unique needs, challenges, and medical realities of individuals living with SCI."
57
+
58
+ prompt = f"{system_context}\n\n### Instruction:\n{your_question}\n\n### Response:\n"
59
+
60
+ # Generate response
61
+ inputs = tokenizer(prompt, return_tensors="pt")
62
+ outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
63
+ response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
64
+ ```
65
+
66
+ ## Intended Use
67
+
68
+ This model is designed to:
69
+ - Provide SCI-specific information and guidance
70
+ - Answer questions about daily life with spinal cord injuries
71
+ - Offer practical advice for common SCI challenges
72
+ - Support the SCI community with contextually appropriate responses
73
+
74
+ ## Limitations
75
+
76
+ - This model is for informational purposes only and should not replace professional medical advice
77
+ - Always consult with healthcare providers for medical decisions
78
+ - The model may not have information about the latest medical developments
79
+ - Responses should be verified with medical professionals when making health-related decisions
80
+
81
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
82
+
83
+ [More Information Needed]
84
+
85
+ ### Downstream Use [optional]
86
+
87
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
88
+
89
+ [More Information Needed]
90
+
91
+ ### Out-of-Scope Use
92
+
93
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
94
+
95
+ [More Information Needed]
96
+
97
+ ## Bias, Risks, and Limitations
98
+
99
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ### Recommendations
104
+
105
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
106
+
107
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
108
+
109
+ ## How to Get Started with the Model
110
+
111
+ Use the code below to get started with the model.
112
+
113
+ [More Information Needed]
114
+
115
+ ## Training Details
116
+
117
+ ### Training Data
118
+
119
+ <!-- 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. -->
120
+
121
+ [More Information Needed]
122
+
123
+ ### Training Procedure
124
+
125
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
126
+
127
+ #### Preprocessing [optional]
128
+
129
+ [More Information Needed]
130
+
131
+
132
+ #### Training Hyperparameters
133
+
134
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
135
+
136
+ #### Speeds, Sizes, Times [optional]
137
+
138
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
139
+
140
+ [More Information Needed]
141
+
142
+ ## Evaluation
143
+
144
+ <!-- This section describes the evaluation protocols and provides the results. -->
145
+
146
+ ### Testing Data, Factors & Metrics
147
+
148
+ #### Testing Data
149
+
150
+ <!-- This should link to a Dataset Card if possible. -->
151
+
152
+ [More Information Needed]
153
+
154
+ #### Factors
155
+
156
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
157
+
158
+ [More Information Needed]
159
+
160
+ #### Metrics
161
+
162
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
163
+
164
+ [More Information Needed]
165
+
166
+ ### Results
167
+
168
+ [More Information Needed]
169
+
170
+ #### Summary
171
+
172
+
173
+
174
+ ## Model Examination [optional]
175
+
176
+ <!-- Relevant interpretability work for the model goes here -->
177
+
178
+ [More Information Needed]
179
+
180
+ ## Environmental Impact
181
+
182
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
183
+
184
+ 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).
185
+
186
+ - **Hardware Type:** [More Information Needed]
187
+ - **Hours used:** [More Information Needed]
188
+ - **Cloud Provider:** [More Information Needed]
189
+ - **Compute Region:** [More Information Needed]
190
+ - **Carbon Emitted:** [More Information Needed]
191
+
192
+ ## Technical Specifications [optional]
193
+
194
+ ### Model Architecture and Objective
195
+
196
+ [More Information Needed]
197
+
198
+ ### Compute Infrastructure
199
+
200
+ [More Information Needed]
201
+
202
+ #### Hardware
203
+
204
+ [More Information Needed]
205
+
206
+ #### Software
207
+
208
+ [More Information Needed]
209
+
210
+ ## Citation [optional]
211
+
212
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
213
+
214
+ **BibTeX:**
215
+
216
+ [More Information Needed]
217
+
218
+ **APA:**
219
+
220
+ [More Information Needed]
221
+
222
+ ## Glossary [optional]
223
+
224
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
225
+
226
+ [More Information Needed]
227
+
228
+ ## More Information [optional]
229
+
230
+ [More Information Needed]
231
+
232
+ ## Model Card Authors [optional]
233
+
234
+ [More Information Needed]
235
+
236
+ ## Model Card Contact
237
+
238
+ [More Information Needed]
239
+ ### Framework versions
240
+
241
+ - PEFT 0.16.0
adapter_config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": null,
5
+ "bias": "none",
6
+ "corda_config": null,
7
+ "eva_config": null,
8
+ "exclude_modules": null,
9
+ "fan_in_fan_out": false,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layer_replication": null,
13
+ "layers_pattern": null,
14
+ "layers_to_transform": null,
15
+ "loftq_config": {},
16
+ "lora_alpha": 32,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.05,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "qalora_group_size": 16,
24
+ "r": 16,
25
+ "rank_pattern": {},
26
+ "revision": null,
27
+ "target_modules": [
28
+ "v_proj",
29
+ "q_proj"
30
+ ],
31
+ "task_type": "CAUSAL_LM",
32
+ "trainable_token_indices": null,
33
+ "use_dora": false,
34
+ "use_qalora": false,
35
+ "use_rslora": false
36
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a2e67314bdcc60127159a78d5b739b059ec0ef93dc34f380fa78b510b92fe94
3
+ size 27282328
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<|im_end|>": 32000,
3
+ "<|im_start|>": 32001
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|im_end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|im_end|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
3
+ size 493443
tokenizer_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "32000": {
31
+ "content": "<|im_end|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "32001": {
39
+ "content": "<|im_start|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": true
45
+ }
46
+ },
47
+ "additional_special_tokens": [],
48
+ "bos_token": "<s>",
49
+ "chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
50
+ "clean_up_tokenization_spaces": false,
51
+ "eos_token": "<|im_end|>",
52
+ "extra_special_tokens": {},
53
+ "legacy": true,
54
+ "model_max_length": 1000000000000000019884624838656,
55
+ "pad_token": "<|im_end|>",
56
+ "sp_model_kwargs": {},
57
+ "spaces_between_special_tokens": false,
58
+ "tokenizer_class": "LlamaTokenizer",
59
+ "trust_remote_code": false,
60
+ "unk_token": "<unk>",
61
+ "use_default_system_prompt": true,
62
+ "use_fast": true
63
+ }