TesterColab commited on
Commit
b392b4b
·
verified ·
1 Parent(s): dd79622

Upload fine-tuned Mistral BP Doctor model

Browse files
README.md ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ tags:
6
+ - medical
7
+ - healthcare
8
+ - blood-pressure
9
+ - mistral
10
+ - conversational-ai
11
+ - health-assistant
12
+ base_model: mistralai/Mistral-7B-Instruct-v0.3
13
+ datasets:
14
+ - TesterColab/MIMICDB
15
+ pipeline_tag: text-generation
16
+ ---
17
+
18
+ # Mistral-7B Blood Pressure Medical Assistant
19
+
20
+ ## Model Description
21
+
22
+ This is a fine-tuned version of **Mistral-7B-Instruct-v0.3** specialized for blood pressure assessment and medical consultation. The model acts as an intelligent medical assistant that:
23
+
24
+ - ✅ Analyzes blood pressure readings
25
+ - ✅ Asks relevant follow-up questions based on BP levels
26
+ - ✅ Provides personalized medical guidance
27
+ - ✅ Handles various scenarios (with/without patient context)
28
+ - ✅ **Never hallucinates information** - only responds to what the patient shares
29
+ - ✅ Recognizes emergency situations (hypertensive crisis)
30
+
31
+ ## Model Type
32
+
33
+ **LoRA Adapter**
34
+
35
+ ## Training Details
36
+
37
+ - **Base Model**: mistralai/Mistral-7B-Instruct-v0.3
38
+ - **Dataset**: TesterColab/MIMICDB (880 clinical examples)
39
+ - **Training Method**: LoRA (Low-Rank Adaptation)
40
+ - **Training Scenarios**:
41
+ 1. BP reading only (model asks questions)
42
+ 2. BP with patient context (model uses provided information)
43
+ 3. Speech-to-text variations
44
+
45
+ ## Usage
46
+
47
+ ### Installation
48
+
49
+ ```bash
50
+ pip install transformers torch peft accelerate
51
+ ```
52
+
53
+ ### Basic Usage
54
+
55
+ ```python
56
+ from transformers import AutoTokenizer, AutoModelForCausalLM
57
+ from peft import PeftModel
58
+
59
+ # Load model
60
+ model_id = "TesterColab/mistral-finetuned-v3"
61
+ base_model_id = "mistralai/Mistral-7B-Instruct-v0.3"
62
+
63
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
64
+ base_model = AutoModelForCausalLM.from_pretrained(base_model_id, device_map='auto', torch_dtype=torch.float16)
65
+ model = PeftModel.from_pretrained(base_model, model_id)
66
+
67
+ # Use the model
68
+ prompt = """<s>[INST] You are a medical doctor. A patient shares their blood pressure reading. Analyze it and respond appropriately - if abnormal, ask relevant questions; if normal, provide encouragement. Never assume information the patient hasn't told you.
69
+
70
+ Patient: My blood pressure is 145 over 95 [/INST]
71
+
72
+ """
73
+
74
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
75
+ outputs = model.generate(**inputs, max_new_tokens=300, temperature=0.7, top_p=0.9)
76
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
77
+ print(response.split('[/INST]')[-1].strip())
78
+ ```
79
+
80
+ ### Example Conversations
81
+
82
+ **Example 1: Normal BP**
83
+ ```
84
+ User: My blood pressure is 115 over 75
85
+ Assistant: Your blood pressure reading of 115/75 mmHg is within the normal range - that's great! To maintain this healthy blood pressure, continue with regular exercise, a balanced diet low in sodium, maintain a healthy weight, limit alcohol, and manage stress. Keep monitoring it regularly.
86
+ ```
87
+
88
+ **Example 2: High BP - Asks Questions**
89
+ ```
90
+ User: 145 over 95
91
+ Assistant: Your blood pressure reading of 145/95 indicates Stage 2 hypertension. To help you properly, I need to understand your health better. Can you tell me: Do you smoke? How often do you exercise? Do you have any family history of heart disease or stroke? Are you currently taking any medications?
92
+ ```
93
+
94
+ **Example 3: With Context**
95
+ ```
96
+ User: My BP is 130 over 85 and I smoke
97
+ Assistant: Your blood pressure reading of 130/85 shows Stage 1 hypertension, and smoking is a significant risk factor that can worsen this. I need to understand more: How much do you smoke per day? How long have you been smoking? Have you tried to quit before? Also, tell me about your exercise routine and diet.
98
+ ```
99
+
100
+ ## Intended Use
101
+
102
+ - 🏥 Health monitoring applications
103
+ - 📱 Mobile health assistants
104
+ - 💬 Conversational health bots
105
+ - 🩺 Telemedicine support tools
106
+
107
+ ## Limitations
108
+
109
+ ⚠️ **Important Medical Disclaimer**:
110
+ - This model is for **informational purposes only**
111
+ - **NOT a replacement for professional medical advice**
112
+ - Always consult healthcare professionals for medical decisions
113
+ - In emergencies (chest pain, severe symptoms), seek immediate medical care
114
+ - Model may occasionally generate incorrect medical information
115
+
116
+ ## Ethical Considerations
117
+
118
+ - Trained to recognize emergency situations
119
+ - Asks appropriate follow-up questions
120
+ - Does not assume or hallucinate patient information
121
+ - Provides general guidance, not diagnoses
122
+ - Encourages seeking professional medical care when appropriate
123
+
124
+ ## Training Data
125
+
126
+ Trained on the MIMICDB dataset containing clinical blood pressure readings with patient context including:
127
+ - Age groups
128
+ - Smoking status
129
+ - Pregnancy status
130
+ - Activity levels
131
+ - Diet information
132
+ - ABP (Arterial Blood Pressure) measurements
133
+
134
+ ## Performance
135
+
136
+ The model has been trained to handle multiple scenarios:
137
+ - ✅ BP readings without context → Asks appropriate questions
138
+ - ✅ BP readings with patient info → Uses provided context
139
+ - ✅ Emergency situations → Recognizes and advises immediate care
140
+ - ✅ Normal readings → Provides encouragement and maintenance tips
141
+
142
+ ## Citation
143
+
144
+ ```bibtex
145
+ @model{mistral-bp-doctor,
146
+ author = {TesterColab},
147
+ title = {Mistral-7B Blood Pressure Medical Assistant},
148
+ year = {2024},
149
+ publisher = {HuggingFace},
150
+ url = {https://huggingface.co/TesterColab/mistral-finetuned-v3}
151
+ }
152
+ ```
153
+
154
+ ## License
155
+
156
+ Apache 2.0 (inherits from Mistral-7B-Instruct-v0.3)
157
+
158
+ ## Contact
159
+
160
+ For questions or issues, please open an issue on the model repository.
161
+
162
+ ---
163
+
164
+ **Built with ❤️ for better health monitoring**
adapter_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "mistralai/Mistral-7B-Instruct-v0.3",
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": 16,
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": 64,
25
+ "rank_pattern": {},
26
+ "revision": null,
27
+ "target_modules": [
28
+ "q_proj",
29
+ "down_proj",
30
+ "gate_proj",
31
+ "o_proj",
32
+ "up_proj",
33
+ "v_proj",
34
+ "k_proj"
35
+ ],
36
+ "target_parameters": null,
37
+ "task_type": "CAUSAL_LM",
38
+ "trainable_token_indices": null,
39
+ "use_dora": false,
40
+ "use_qalora": false,
41
+ "use_rslora": false
42
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:647b406a89aa7eef1ef90b8f2a7072954db3eabd841f067d3fbed30bebb6a894
3
+ size 671149168
chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if messages[0]["role"] == "system" %}
2
+ {%- set system_message = messages[0]["content"] %}
3
+ {%- set loop_messages = messages[1:] %}
4
+ {%- else %}
5
+ {%- set loop_messages = messages %}
6
+ {%- endif %}
7
+ {%- if not tools is defined %}
8
+ {%- set tools = none %}
9
+ {%- endif %}
10
+ {%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
11
+
12
+ {#- This block checks for alternating user/assistant messages, skipping tool calling messages #}
13
+ {%- set ns = namespace() %}
14
+ {%- set ns.index = 0 %}
15
+ {%- for message in loop_messages %}
16
+ {%- if not (message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %}
17
+ {%- if (message["role"] == "user") != (ns.index % 2 == 0) %}
18
+ {{- raise_exception("After the optional system message, conversation roles must alternate user/assistant/user/assistant/...") }}
19
+ {%- endif %}
20
+ {%- set ns.index = ns.index + 1 %}
21
+ {%- endif %}
22
+ {%- endfor %}
23
+
24
+ {{- bos_token }}
25
+ {%- for message in loop_messages %}
26
+ {%- if message["role"] == "user" %}
27
+ {%- if tools is not none and (message == user_messages[-1]) %}
28
+ {{- "[AVAILABLE_TOOLS] [" }}
29
+ {%- for tool in tools %}
30
+ {%- set tool = tool.function %}
31
+ {{- '{"type": "function", "function": {' }}
32
+ {%- for key, val in tool.items() if key != "return" %}
33
+ {%- if val is string %}
34
+ {{- '"' + key + '": "' + val + '"' }}
35
+ {%- else %}
36
+ {{- '"' + key + '": ' + val|tojson }}
37
+ {%- endif %}
38
+ {%- if not loop.last %}
39
+ {{- ", " }}
40
+ {%- endif %}
41
+ {%- endfor %}
42
+ {{- "}}" }}
43
+ {%- if not loop.last %}
44
+ {{- ", " }}
45
+ {%- else %}
46
+ {{- "]" }}
47
+ {%- endif %}
48
+ {%- endfor %}
49
+ {{- "[/AVAILABLE_TOOLS]" }}
50
+ {%- endif %}
51
+ {%- if loop.last and system_message is defined %}
52
+ {{- "[INST] " + system_message + "\n\n" + message["content"] + "[/INST]" }}
53
+ {%- else %}
54
+ {{- "[INST] " + message["content"] + "[/INST]" }}
55
+ {%- endif %}
56
+ {%- elif message.tool_calls is defined and message.tool_calls is not none %}
57
+ {{- "[TOOL_CALLS] [" }}
58
+ {%- for tool_call in message.tool_calls %}
59
+ {%- set out = tool_call.function|tojson %}
60
+ {{- out[:-1] }}
61
+ {%- if not tool_call.id is defined or tool_call.id|length != 9 %}
62
+ {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
63
+ {%- endif %}
64
+ {{- ', "id": "' + tool_call.id + '"}' }}
65
+ {%- if not loop.last %}
66
+ {{- ", " }}
67
+ {%- else %}
68
+ {{- "]" + eos_token }}
69
+ {%- endif %}
70
+ {%- endfor %}
71
+ {%- elif message["role"] == "assistant" %}
72
+ {{- " " + message["content"]|trim + eos_token}}
73
+ {%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
74
+ {%- if message.content is defined and message.content.content is defined %}
75
+ {%- set content = message.content.content %}
76
+ {%- else %}
77
+ {%- set content = message.content %}
78
+ {%- endif %}
79
+ {{- '[TOOL_RESULTS] {"content": ' + content|string + ", " }}
80
+ {%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}
81
+ {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
82
+ {%- endif %}
83
+ {{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
84
+ {%- else %}
85
+ {{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
86
+ {%- endif %}
87
+ {%- endfor %}
checkpoint-298/README.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mistral-7B-Instruct-v0.3
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:mistralai/Mistral-7B-Instruct-v0.3
7
+ - lora
8
+ - transformers
9
+ ---
10
+
11
+ # Model Card for Model ID
12
+
13
+ <!-- Provide a quick summary of what the model is/does. -->
14
+
15
+
16
+
17
+ ## Model Details
18
+
19
+ ### Model Description
20
+
21
+ <!-- Provide a longer summary of what this model is. -->
22
+
23
+
24
+
25
+ - **Developed by:** [More Information Needed]
26
+ - **Funded by [optional]:** [More Information Needed]
27
+ - **Shared by [optional]:** [More Information Needed]
28
+ - **Model type:** [More Information Needed]
29
+ - **Language(s) (NLP):** [More Information Needed]
30
+ - **License:** [More Information Needed]
31
+ - **Finetuned from model [optional]:** [More Information Needed]
32
+
33
+ ### Model Sources [optional]
34
+
35
+ <!-- Provide the basic links for the model. -->
36
+
37
+ - **Repository:** [More Information Needed]
38
+ - **Paper [optional]:** [More Information Needed]
39
+ - **Demo [optional]:** [More Information Needed]
40
+
41
+ ## Uses
42
+
43
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
44
+
45
+ ### Direct Use
46
+
47
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
48
+
49
+ [More Information Needed]
50
+
51
+ ### Downstream Use [optional]
52
+
53
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
54
+
55
+ [More Information Needed]
56
+
57
+ ### Out-of-Scope Use
58
+
59
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
60
+
61
+ [More Information Needed]
62
+
63
+ ## Bias, Risks, and Limitations
64
+
65
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
66
+
67
+ [More Information Needed]
68
+
69
+ ### Recommendations
70
+
71
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
72
+
73
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
74
+
75
+ ## How to Get Started with the Model
76
+
77
+ Use the code below to get started with the model.
78
+
79
+ [More Information Needed]
80
+
81
+ ## Training Details
82
+
83
+ ### Training Data
84
+
85
+ <!-- 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. -->
86
+
87
+ [More Information Needed]
88
+
89
+ ### Training Procedure
90
+
91
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
92
+
93
+ #### Preprocessing [optional]
94
+
95
+ [More Information Needed]
96
+
97
+
98
+ #### Training Hyperparameters
99
+
100
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
101
+
102
+ #### Speeds, Sizes, Times [optional]
103
+
104
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
105
+
106
+ [More Information Needed]
107
+
108
+ ## Evaluation
109
+
110
+ <!-- This section describes the evaluation protocols and provides the results. -->
111
+
112
+ ### Testing Data, Factors & Metrics
113
+
114
+ #### Testing Data
115
+
116
+ <!-- This should link to a Dataset Card if possible. -->
117
+
118
+ [More Information Needed]
119
+
120
+ #### Factors
121
+
122
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
123
+
124
+ [More Information Needed]
125
+
126
+ #### Metrics
127
+
128
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
129
+
130
+ [More Information Needed]
131
+
132
+ ### Results
133
+
134
+ [More Information Needed]
135
+
136
+ #### Summary
137
+
138
+
139
+
140
+ ## Model Examination [optional]
141
+
142
+ <!-- Relevant interpretability work for the model goes here -->
143
+
144
+ [More Information Needed]
145
+
146
+ ## Environmental Impact
147
+
148
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
149
+
150
+ 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).
151
+
152
+ - **Hardware Type:** [More Information Needed]
153
+ - **Hours used:** [More Information Needed]
154
+ - **Cloud Provider:** [More Information Needed]
155
+ - **Compute Region:** [More Information Needed]
156
+ - **Carbon Emitted:** [More Information Needed]
157
+
158
+ ## Technical Specifications [optional]
159
+
160
+ ### Model Architecture and Objective
161
+
162
+ [More Information Needed]
163
+
164
+ ### Compute Infrastructure
165
+
166
+ [More Information Needed]
167
+
168
+ #### Hardware
169
+
170
+ [More Information Needed]
171
+
172
+ #### Software
173
+
174
+ [More Information Needed]
175
+
176
+ ## Citation [optional]
177
+
178
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
179
+
180
+ **BibTeX:**
181
+
182
+ [More Information Needed]
183
+
184
+ **APA:**
185
+
186
+ [More Information Needed]
187
+
188
+ ## Glossary [optional]
189
+
190
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
191
+
192
+ [More Information Needed]
193
+
194
+ ## More Information [optional]
195
+
196
+ [More Information Needed]
197
+
198
+ ## Model Card Authors [optional]
199
+
200
+ [More Information Needed]
201
+
202
+ ## Model Card Contact
203
+
204
+ [More Information Needed]
205
+ ### Framework versions
206
+
207
+ - PEFT 0.17.1
checkpoint-298/adapter_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "mistralai/Mistral-7B-Instruct-v0.3",
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": 16,
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": 64,
25
+ "rank_pattern": {},
26
+ "revision": null,
27
+ "target_modules": [
28
+ "q_proj",
29
+ "down_proj",
30
+ "gate_proj",
31
+ "o_proj",
32
+ "up_proj",
33
+ "v_proj",
34
+ "k_proj"
35
+ ],
36
+ "target_parameters": null,
37
+ "task_type": "CAUSAL_LM",
38
+ "trainable_token_indices": null,
39
+ "use_dora": false,
40
+ "use_qalora": false,
41
+ "use_rslora": false
42
+ }
checkpoint-298/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cbbad7bd61b442e37b325c37839b74ef3a744cf3682d4e942e38f59cf2ab04cc
3
+ size 671149168
checkpoint-298/chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if messages[0]["role"] == "system" %}
2
+ {%- set system_message = messages[0]["content"] %}
3
+ {%- set loop_messages = messages[1:] %}
4
+ {%- else %}
5
+ {%- set loop_messages = messages %}
6
+ {%- endif %}
7
+ {%- if not tools is defined %}
8
+ {%- set tools = none %}
9
+ {%- endif %}
10
+ {%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
11
+
12
+ {#- This block checks for alternating user/assistant messages, skipping tool calling messages #}
13
+ {%- set ns = namespace() %}
14
+ {%- set ns.index = 0 %}
15
+ {%- for message in loop_messages %}
16
+ {%- if not (message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %}
17
+ {%- if (message["role"] == "user") != (ns.index % 2 == 0) %}
18
+ {{- raise_exception("After the optional system message, conversation roles must alternate user/assistant/user/assistant/...") }}
19
+ {%- endif %}
20
+ {%- set ns.index = ns.index + 1 %}
21
+ {%- endif %}
22
+ {%- endfor %}
23
+
24
+ {{- bos_token }}
25
+ {%- for message in loop_messages %}
26
+ {%- if message["role"] == "user" %}
27
+ {%- if tools is not none and (message == user_messages[-1]) %}
28
+ {{- "[AVAILABLE_TOOLS] [" }}
29
+ {%- for tool in tools %}
30
+ {%- set tool = tool.function %}
31
+ {{- '{"type": "function", "function": {' }}
32
+ {%- for key, val in tool.items() if key != "return" %}
33
+ {%- if val is string %}
34
+ {{- '"' + key + '": "' + val + '"' }}
35
+ {%- else %}
36
+ {{- '"' + key + '": ' + val|tojson }}
37
+ {%- endif %}
38
+ {%- if not loop.last %}
39
+ {{- ", " }}
40
+ {%- endif %}
41
+ {%- endfor %}
42
+ {{- "}}" }}
43
+ {%- if not loop.last %}
44
+ {{- ", " }}
45
+ {%- else %}
46
+ {{- "]" }}
47
+ {%- endif %}
48
+ {%- endfor %}
49
+ {{- "[/AVAILABLE_TOOLS]" }}
50
+ {%- endif %}
51
+ {%- if loop.last and system_message is defined %}
52
+ {{- "[INST] " + system_message + "\n\n" + message["content"] + "[/INST]" }}
53
+ {%- else %}
54
+ {{- "[INST] " + message["content"] + "[/INST]" }}
55
+ {%- endif %}
56
+ {%- elif message.tool_calls is defined and message.tool_calls is not none %}
57
+ {{- "[TOOL_CALLS] [" }}
58
+ {%- for tool_call in message.tool_calls %}
59
+ {%- set out = tool_call.function|tojson %}
60
+ {{- out[:-1] }}
61
+ {%- if not tool_call.id is defined or tool_call.id|length != 9 %}
62
+ {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
63
+ {%- endif %}
64
+ {{- ', "id": "' + tool_call.id + '"}' }}
65
+ {%- if not loop.last %}
66
+ {{- ", " }}
67
+ {%- else %}
68
+ {{- "]" + eos_token }}
69
+ {%- endif %}
70
+ {%- endfor %}
71
+ {%- elif message["role"] == "assistant" %}
72
+ {{- " " + message["content"]|trim + eos_token}}
73
+ {%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
74
+ {%- if message.content is defined and message.content.content is defined %}
75
+ {%- set content = message.content.content %}
76
+ {%- else %}
77
+ {%- set content = message.content %}
78
+ {%- endif %}
79
+ {{- '[TOOL_RESULTS] {"content": ' + content|string + ", " }}
80
+ {%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}
81
+ {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
82
+ {%- endif %}
83
+ {{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
84
+ {%- else %}
85
+ {{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
86
+ {%- endif %}
87
+ {%- endfor %}
checkpoint-298/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8010c218b46eae68d0ae211f866b65cdfc91b92fbc2390ec3dd5b59ef20f6d56
3
+ size 1342453899
checkpoint-298/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cffca8166398eac90c27cd2a42adf9d0eced63586e3fa75dc51c2546f8a487a5
3
+ size 14645
checkpoint-298/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b928064440f9470d27d84fe30538095e46afc896a930478830ece74934641668
3
+ size 1465
checkpoint-298/special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
checkpoint-298/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-298/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
3
+ size 587404
checkpoint-298/tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-298/trainer_state.json ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": 298,
3
+ "best_metric": 0.24624043703079224,
4
+ "best_model_checkpoint": "./mistral-bp-doctor/checkpoint-298",
5
+ "epoch": 2.0,
6
+ "eval_steps": 500,
7
+ "global_step": 298,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.13468013468013468,
14
+ "grad_norm": 0.5559964776039124,
15
+ "learning_rate": 0.00019993420599300602,
16
+ "loss": 1.9115,
17
+ "step": 20
18
+ },
19
+ {
20
+ "epoch": 0.26936026936026936,
21
+ "grad_norm": 0.375236839056015,
22
+ "learning_rate": 0.000198359474690631,
23
+ "loss": 0.389,
24
+ "step": 40
25
+ },
26
+ {
27
+ "epoch": 0.40404040404040403,
28
+ "grad_norm": 0.19160901010036469,
29
+ "learning_rate": 0.00019471727939498744,
30
+ "loss": 0.2647,
31
+ "step": 60
32
+ },
33
+ {
34
+ "epoch": 0.5387205387205387,
35
+ "grad_norm": 0.1633908897638321,
36
+ "learning_rate": 0.00018908417711955972,
37
+ "loss": 0.2575,
38
+ "step": 80
39
+ },
40
+ {
41
+ "epoch": 0.6734006734006734,
42
+ "grad_norm": 0.06298425048589706,
43
+ "learning_rate": 0.00018157857268667396,
44
+ "loss": 0.255,
45
+ "step": 100
46
+ },
47
+ {
48
+ "epoch": 0.8080808080808081,
49
+ "grad_norm": 0.07009627670049667,
50
+ "learning_rate": 0.00017235822992092893,
51
+ "loss": 0.2513,
52
+ "step": 120
53
+ },
54
+ {
55
+ "epoch": 0.9427609427609428,
56
+ "grad_norm": 0.05074545741081238,
57
+ "learning_rate": 0.0001616169555372722,
58
+ "loss": 0.2516,
59
+ "step": 140
60
+ },
61
+ {
62
+ "epoch": 1.0,
63
+ "eval_loss": 0.2505706548690796,
64
+ "eval_runtime": 74.0922,
65
+ "eval_samples_per_second": 3.563,
66
+ "eval_steps_per_second": 0.891,
67
+ "step": 149
68
+ },
69
+ {
70
+ "epoch": 1.074074074074074,
71
+ "grad_norm": 0.0452318899333477,
72
+ "learning_rate": 0.00014958052542663727,
73
+ "loss": 0.2496,
74
+ "step": 160
75
+ },
76
+ {
77
+ "epoch": 1.2087542087542087,
78
+ "grad_norm": 0.047174468636512756,
79
+ "learning_rate": 0.00013650193896645583,
80
+ "loss": 0.2506,
81
+ "step": 180
82
+ },
83
+ {
84
+ "epoch": 1.3434343434343434,
85
+ "grad_norm": 0.05392182618379593,
86
+ "learning_rate": 0.0001226561011079216,
87
+ "loss": 0.2498,
88
+ "step": 200
89
+ },
90
+ {
91
+ "epoch": 1.4781144781144782,
92
+ "grad_norm": 0.04376411437988281,
93
+ "learning_rate": 0.0001083340440197117,
94
+ "loss": 0.2484,
95
+ "step": 220
96
+ },
97
+ {
98
+ "epoch": 1.612794612794613,
99
+ "grad_norm": 0.04754996299743652,
100
+ "learning_rate": 9.383680974614915e-05,
101
+ "loss": 0.2462,
102
+ "step": 240
103
+ },
104
+ {
105
+ "epoch": 1.7474747474747474,
106
+ "grad_norm": 0.03840889409184456,
107
+ "learning_rate": 7.94691224630883e-05,
108
+ "loss": 0.2445,
109
+ "step": 260
110
+ },
111
+ {
112
+ "epoch": 1.8821548821548821,
113
+ "grad_norm": 0.04592665284872055,
114
+ "learning_rate": 6.553298333734812e-05,
115
+ "loss": 0.2455,
116
+ "step": 280
117
+ },
118
+ {
119
+ "epoch": 2.0,
120
+ "eval_loss": 0.24624043703079224,
121
+ "eval_runtime": 74.1325,
122
+ "eval_samples_per_second": 3.561,
123
+ "eval_steps_per_second": 0.89,
124
+ "step": 298
125
+ }
126
+ ],
127
+ "logging_steps": 20,
128
+ "max_steps": 447,
129
+ "num_input_tokens_seen": 0,
130
+ "num_train_epochs": 3,
131
+ "save_steps": 500,
132
+ "stateful_callbacks": {
133
+ "TrainerControl": {
134
+ "args": {
135
+ "should_epoch_stop": false,
136
+ "should_evaluate": false,
137
+ "should_log": false,
138
+ "should_save": true,
139
+ "should_training_stop": false
140
+ },
141
+ "attributes": {}
142
+ }
143
+ },
144
+ "total_flos": 4.251900958306468e+17,
145
+ "train_batch_size": 4,
146
+ "trial_name": null,
147
+ "trial_params": null
148
+ }
checkpoint-298/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca3368fe8425b6a161e11d6c1fbbf66be8646beca69bf81193ad2a1292f8d3c8
3
+ size 5841
checkpoint-447/README.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mistral-7B-Instruct-v0.3
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:mistralai/Mistral-7B-Instruct-v0.3
7
+ - lora
8
+ - transformers
9
+ ---
10
+
11
+ # Model Card for Model ID
12
+
13
+ <!-- Provide a quick summary of what the model is/does. -->
14
+
15
+
16
+
17
+ ## Model Details
18
+
19
+ ### Model Description
20
+
21
+ <!-- Provide a longer summary of what this model is. -->
22
+
23
+
24
+
25
+ - **Developed by:** [More Information Needed]
26
+ - **Funded by [optional]:** [More Information Needed]
27
+ - **Shared by [optional]:** [More Information Needed]
28
+ - **Model type:** [More Information Needed]
29
+ - **Language(s) (NLP):** [More Information Needed]
30
+ - **License:** [More Information Needed]
31
+ - **Finetuned from model [optional]:** [More Information Needed]
32
+
33
+ ### Model Sources [optional]
34
+
35
+ <!-- Provide the basic links for the model. -->
36
+
37
+ - **Repository:** [More Information Needed]
38
+ - **Paper [optional]:** [More Information Needed]
39
+ - **Demo [optional]:** [More Information Needed]
40
+
41
+ ## Uses
42
+
43
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
44
+
45
+ ### Direct Use
46
+
47
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
48
+
49
+ [More Information Needed]
50
+
51
+ ### Downstream Use [optional]
52
+
53
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
54
+
55
+ [More Information Needed]
56
+
57
+ ### Out-of-Scope Use
58
+
59
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
60
+
61
+ [More Information Needed]
62
+
63
+ ## Bias, Risks, and Limitations
64
+
65
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
66
+
67
+ [More Information Needed]
68
+
69
+ ### Recommendations
70
+
71
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
72
+
73
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
74
+
75
+ ## How to Get Started with the Model
76
+
77
+ Use the code below to get started with the model.
78
+
79
+ [More Information Needed]
80
+
81
+ ## Training Details
82
+
83
+ ### Training Data
84
+
85
+ <!-- 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. -->
86
+
87
+ [More Information Needed]
88
+
89
+ ### Training Procedure
90
+
91
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
92
+
93
+ #### Preprocessing [optional]
94
+
95
+ [More Information Needed]
96
+
97
+
98
+ #### Training Hyperparameters
99
+
100
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
101
+
102
+ #### Speeds, Sizes, Times [optional]
103
+
104
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
105
+
106
+ [More Information Needed]
107
+
108
+ ## Evaluation
109
+
110
+ <!-- This section describes the evaluation protocols and provides the results. -->
111
+
112
+ ### Testing Data, Factors & Metrics
113
+
114
+ #### Testing Data
115
+
116
+ <!-- This should link to a Dataset Card if possible. -->
117
+
118
+ [More Information Needed]
119
+
120
+ #### Factors
121
+
122
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
123
+
124
+ [More Information Needed]
125
+
126
+ #### Metrics
127
+
128
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
129
+
130
+ [More Information Needed]
131
+
132
+ ### Results
133
+
134
+ [More Information Needed]
135
+
136
+ #### Summary
137
+
138
+
139
+
140
+ ## Model Examination [optional]
141
+
142
+ <!-- Relevant interpretability work for the model goes here -->
143
+
144
+ [More Information Needed]
145
+
146
+ ## Environmental Impact
147
+
148
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
149
+
150
+ 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).
151
+
152
+ - **Hardware Type:** [More Information Needed]
153
+ - **Hours used:** [More Information Needed]
154
+ - **Cloud Provider:** [More Information Needed]
155
+ - **Compute Region:** [More Information Needed]
156
+ - **Carbon Emitted:** [More Information Needed]
157
+
158
+ ## Technical Specifications [optional]
159
+
160
+ ### Model Architecture and Objective
161
+
162
+ [More Information Needed]
163
+
164
+ ### Compute Infrastructure
165
+
166
+ [More Information Needed]
167
+
168
+ #### Hardware
169
+
170
+ [More Information Needed]
171
+
172
+ #### Software
173
+
174
+ [More Information Needed]
175
+
176
+ ## Citation [optional]
177
+
178
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
179
+
180
+ **BibTeX:**
181
+
182
+ [More Information Needed]
183
+
184
+ **APA:**
185
+
186
+ [More Information Needed]
187
+
188
+ ## Glossary [optional]
189
+
190
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
191
+
192
+ [More Information Needed]
193
+
194
+ ## More Information [optional]
195
+
196
+ [More Information Needed]
197
+
198
+ ## Model Card Authors [optional]
199
+
200
+ [More Information Needed]
201
+
202
+ ## Model Card Contact
203
+
204
+ [More Information Needed]
205
+ ### Framework versions
206
+
207
+ - PEFT 0.17.1
checkpoint-447/adapter_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "mistralai/Mistral-7B-Instruct-v0.3",
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": 16,
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": 64,
25
+ "rank_pattern": {},
26
+ "revision": null,
27
+ "target_modules": [
28
+ "q_proj",
29
+ "down_proj",
30
+ "gate_proj",
31
+ "o_proj",
32
+ "up_proj",
33
+ "v_proj",
34
+ "k_proj"
35
+ ],
36
+ "target_parameters": null,
37
+ "task_type": "CAUSAL_LM",
38
+ "trainable_token_indices": null,
39
+ "use_dora": false,
40
+ "use_qalora": false,
41
+ "use_rslora": false
42
+ }
checkpoint-447/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:647b406a89aa7eef1ef90b8f2a7072954db3eabd841f067d3fbed30bebb6a894
3
+ size 671149168
checkpoint-447/chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if messages[0]["role"] == "system" %}
2
+ {%- set system_message = messages[0]["content"] %}
3
+ {%- set loop_messages = messages[1:] %}
4
+ {%- else %}
5
+ {%- set loop_messages = messages %}
6
+ {%- endif %}
7
+ {%- if not tools is defined %}
8
+ {%- set tools = none %}
9
+ {%- endif %}
10
+ {%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
11
+
12
+ {#- This block checks for alternating user/assistant messages, skipping tool calling messages #}
13
+ {%- set ns = namespace() %}
14
+ {%- set ns.index = 0 %}
15
+ {%- for message in loop_messages %}
16
+ {%- if not (message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %}
17
+ {%- if (message["role"] == "user") != (ns.index % 2 == 0) %}
18
+ {{- raise_exception("After the optional system message, conversation roles must alternate user/assistant/user/assistant/...") }}
19
+ {%- endif %}
20
+ {%- set ns.index = ns.index + 1 %}
21
+ {%- endif %}
22
+ {%- endfor %}
23
+
24
+ {{- bos_token }}
25
+ {%- for message in loop_messages %}
26
+ {%- if message["role"] == "user" %}
27
+ {%- if tools is not none and (message == user_messages[-1]) %}
28
+ {{- "[AVAILABLE_TOOLS] [" }}
29
+ {%- for tool in tools %}
30
+ {%- set tool = tool.function %}
31
+ {{- '{"type": "function", "function": {' }}
32
+ {%- for key, val in tool.items() if key != "return" %}
33
+ {%- if val is string %}
34
+ {{- '"' + key + '": "' + val + '"' }}
35
+ {%- else %}
36
+ {{- '"' + key + '": ' + val|tojson }}
37
+ {%- endif %}
38
+ {%- if not loop.last %}
39
+ {{- ", " }}
40
+ {%- endif %}
41
+ {%- endfor %}
42
+ {{- "}}" }}
43
+ {%- if not loop.last %}
44
+ {{- ", " }}
45
+ {%- else %}
46
+ {{- "]" }}
47
+ {%- endif %}
48
+ {%- endfor %}
49
+ {{- "[/AVAILABLE_TOOLS]" }}
50
+ {%- endif %}
51
+ {%- if loop.last and system_message is defined %}
52
+ {{- "[INST] " + system_message + "\n\n" + message["content"] + "[/INST]" }}
53
+ {%- else %}
54
+ {{- "[INST] " + message["content"] + "[/INST]" }}
55
+ {%- endif %}
56
+ {%- elif message.tool_calls is defined and message.tool_calls is not none %}
57
+ {{- "[TOOL_CALLS] [" }}
58
+ {%- for tool_call in message.tool_calls %}
59
+ {%- set out = tool_call.function|tojson %}
60
+ {{- out[:-1] }}
61
+ {%- if not tool_call.id is defined or tool_call.id|length != 9 %}
62
+ {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
63
+ {%- endif %}
64
+ {{- ', "id": "' + tool_call.id + '"}' }}
65
+ {%- if not loop.last %}
66
+ {{- ", " }}
67
+ {%- else %}
68
+ {{- "]" + eos_token }}
69
+ {%- endif %}
70
+ {%- endfor %}
71
+ {%- elif message["role"] == "assistant" %}
72
+ {{- " " + message["content"]|trim + eos_token}}
73
+ {%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
74
+ {%- if message.content is defined and message.content.content is defined %}
75
+ {%- set content = message.content.content %}
76
+ {%- else %}
77
+ {%- set content = message.content %}
78
+ {%- endif %}
79
+ {{- '[TOOL_RESULTS] {"content": ' + content|string + ", " }}
80
+ {%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}
81
+ {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
82
+ {%- endif %}
83
+ {{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
84
+ {%- else %}
85
+ {{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
86
+ {%- endif %}
87
+ {%- endfor %}
checkpoint-447/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e9a81f860788f58fd5724dda5a3e873d164e954d84d23e82c6fe76ed2a476d6
3
+ size 1342453899
checkpoint-447/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df6019d1a263972b8c72790fdf52a4d03fece316e28934235558eba2015691e2
3
+ size 14645
checkpoint-447/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:933b2ebad8ab9bcd2ab2c854312edd4dba7ae2b2e84a3ca300d969531f4485df
3
+ size 1465
checkpoint-447/special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
checkpoint-447/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-447/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
3
+ size 587404
checkpoint-447/tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-447/trainer_state.json ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": 447,
3
+ "best_metric": 0.24426761269569397,
4
+ "best_model_checkpoint": "./mistral-bp-doctor/checkpoint-447",
5
+ "epoch": 3.0,
6
+ "eval_steps": 500,
7
+ "global_step": 447,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.13468013468013468,
14
+ "grad_norm": 0.5559964776039124,
15
+ "learning_rate": 0.00019993420599300602,
16
+ "loss": 1.9115,
17
+ "step": 20
18
+ },
19
+ {
20
+ "epoch": 0.26936026936026936,
21
+ "grad_norm": 0.375236839056015,
22
+ "learning_rate": 0.000198359474690631,
23
+ "loss": 0.389,
24
+ "step": 40
25
+ },
26
+ {
27
+ "epoch": 0.40404040404040403,
28
+ "grad_norm": 0.19160901010036469,
29
+ "learning_rate": 0.00019471727939498744,
30
+ "loss": 0.2647,
31
+ "step": 60
32
+ },
33
+ {
34
+ "epoch": 0.5387205387205387,
35
+ "grad_norm": 0.1633908897638321,
36
+ "learning_rate": 0.00018908417711955972,
37
+ "loss": 0.2575,
38
+ "step": 80
39
+ },
40
+ {
41
+ "epoch": 0.6734006734006734,
42
+ "grad_norm": 0.06298425048589706,
43
+ "learning_rate": 0.00018157857268667396,
44
+ "loss": 0.255,
45
+ "step": 100
46
+ },
47
+ {
48
+ "epoch": 0.8080808080808081,
49
+ "grad_norm": 0.07009627670049667,
50
+ "learning_rate": 0.00017235822992092893,
51
+ "loss": 0.2513,
52
+ "step": 120
53
+ },
54
+ {
55
+ "epoch": 0.9427609427609428,
56
+ "grad_norm": 0.05074545741081238,
57
+ "learning_rate": 0.0001616169555372722,
58
+ "loss": 0.2516,
59
+ "step": 140
60
+ },
61
+ {
62
+ "epoch": 1.0,
63
+ "eval_loss": 0.2505706548690796,
64
+ "eval_runtime": 74.0922,
65
+ "eval_samples_per_second": 3.563,
66
+ "eval_steps_per_second": 0.891,
67
+ "step": 149
68
+ },
69
+ {
70
+ "epoch": 1.074074074074074,
71
+ "grad_norm": 0.0452318899333477,
72
+ "learning_rate": 0.00014958052542663727,
73
+ "loss": 0.2496,
74
+ "step": 160
75
+ },
76
+ {
77
+ "epoch": 1.2087542087542087,
78
+ "grad_norm": 0.047174468636512756,
79
+ "learning_rate": 0.00013650193896645583,
80
+ "loss": 0.2506,
81
+ "step": 180
82
+ },
83
+ {
84
+ "epoch": 1.3434343434343434,
85
+ "grad_norm": 0.05392182618379593,
86
+ "learning_rate": 0.0001226561011079216,
87
+ "loss": 0.2498,
88
+ "step": 200
89
+ },
90
+ {
91
+ "epoch": 1.4781144781144782,
92
+ "grad_norm": 0.04376411437988281,
93
+ "learning_rate": 0.0001083340440197117,
94
+ "loss": 0.2484,
95
+ "step": 220
96
+ },
97
+ {
98
+ "epoch": 1.612794612794613,
99
+ "grad_norm": 0.04754996299743652,
100
+ "learning_rate": 9.383680974614915e-05,
101
+ "loss": 0.2462,
102
+ "step": 240
103
+ },
104
+ {
105
+ "epoch": 1.7474747474747474,
106
+ "grad_norm": 0.03840889409184456,
107
+ "learning_rate": 7.94691224630883e-05,
108
+ "loss": 0.2445,
109
+ "step": 260
110
+ },
111
+ {
112
+ "epoch": 1.8821548821548821,
113
+ "grad_norm": 0.04592665284872055,
114
+ "learning_rate": 6.553298333734812e-05,
115
+ "loss": 0.2455,
116
+ "step": 280
117
+ },
118
+ {
119
+ "epoch": 2.0,
120
+ "eval_loss": 0.24624043703079224,
121
+ "eval_runtime": 74.1325,
122
+ "eval_samples_per_second": 3.561,
123
+ "eval_steps_per_second": 0.89,
124
+ "step": 298
125
+ },
126
+ {
127
+ "epoch": 2.0134680134680134,
128
+ "grad_norm": 0.03834633156657219,
129
+ "learning_rate": 5.2321322622351254e-05,
130
+ "loss": 0.2433,
131
+ "step": 300
132
+ },
133
+ {
134
+ "epoch": 2.148148148148148,
135
+ "grad_norm": 0.07271318882703781,
136
+ "learning_rate": 4.011184241955213e-05,
137
+ "loss": 0.243,
138
+ "step": 320
139
+ },
140
+ {
141
+ "epoch": 2.282828282828283,
142
+ "grad_norm": 0.05636134743690491,
143
+ "learning_rate": 2.9161179527542827e-05,
144
+ "loss": 0.2434,
145
+ "step": 340
146
+ },
147
+ {
148
+ "epoch": 2.4175084175084174,
149
+ "grad_norm": 0.06415364146232605,
150
+ "learning_rate": 1.9699511072653733e-05,
151
+ "loss": 0.245,
152
+ "step": 360
153
+ },
154
+ {
155
+ "epoch": 2.5521885521885523,
156
+ "grad_norm": 0.0652865543961525,
157
+ "learning_rate": 1.192571630783179e-05,
158
+ "loss": 0.2413,
159
+ "step": 380
160
+ },
161
+ {
162
+ "epoch": 2.686868686868687,
163
+ "grad_norm": 0.05853720381855965,
164
+ "learning_rate": 6.003196276218814e-06,
165
+ "loss": 0.2419,
166
+ "step": 400
167
+ },
168
+ {
169
+ "epoch": 2.821548821548822,
170
+ "grad_norm": 0.05892040953040123,
171
+ "learning_rate": 2.0564392078839644e-06,
172
+ "loss": 0.2442,
173
+ "step": 420
174
+ },
175
+ {
176
+ "epoch": 2.9562289562289563,
177
+ "grad_norm": 0.07029526680707932,
178
+ "learning_rate": 1.6840384324980917e-07,
179
+ "loss": 0.239,
180
+ "step": 440
181
+ },
182
+ {
183
+ "epoch": 3.0,
184
+ "eval_loss": 0.24426761269569397,
185
+ "eval_runtime": 74.08,
186
+ "eval_samples_per_second": 3.564,
187
+ "eval_steps_per_second": 0.891,
188
+ "step": 447
189
+ }
190
+ ],
191
+ "logging_steps": 20,
192
+ "max_steps": 447,
193
+ "num_input_tokens_seen": 0,
194
+ "num_train_epochs": 3,
195
+ "save_steps": 500,
196
+ "stateful_callbacks": {
197
+ "TrainerControl": {
198
+ "args": {
199
+ "should_epoch_stop": false,
200
+ "should_evaluate": false,
201
+ "should_log": false,
202
+ "should_save": true,
203
+ "should_training_stop": true
204
+ },
205
+ "attributes": {}
206
+ }
207
+ },
208
+ "total_flos": 6.377851437459702e+17,
209
+ "train_batch_size": 4,
210
+ "trial_name": null,
211
+ "trial_params": null
212
+ }
checkpoint-447/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca3368fe8425b6a161e11d6c1fbbf66be8646beca69bf81193ad2a1292f8d3c8
3
+ size 5841
metadata.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "mistralai/Mistral-7B-Instruct-v0.3",
3
+ "dataset": "TesterColab/MIMICDB",
4
+ "approach": "handles_all_scenarios_no_hallucinations",
5
+ "scenarios": [
6
+ "bp_only",
7
+ "bp_with_context",
8
+ "speech_variations"
9
+ ]
10
+ }
runs/Nov07_03-04-15_e648ee70cf1b/events.out.tfevents.1762484659.e648ee70cf1b.2581.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98c1f565f446929d171b7af519e489275d86622cca553d7e712f45fa87098e6d
3
+ size 11290
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
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:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
3
+ size 587404
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca3368fe8425b6a161e11d6c1fbbf66be8646beca69bf81193ad2a1292f8d3c8
3
+ size 5841