FelipeAg5 Nahla-yasmine commited on
Commit
6076502
·
0 Parent(s):

Duplicate from Nahla-yasmine/mistral-7b-french-legal-qa

Browse files

Co-authored-by: nahla <Nahla-yasmine@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - fr
4
+ license: apache-2.0
5
+ base_model: mistralai/Mistral-7B-Instruct-v0.3
6
+ tags:
7
+ - legal
8
+ - french
9
+ - question-answering
10
+ - mistral
11
+ - lora
12
+ - peft
13
+ pipeline_tag: text-generation
14
+ library_name: peft
15
+ ---
16
+
17
+ # Mistral-7B French Legal Q&A Fine-tuned Model
18
+
19
+ This model is a fine-tuned version of [mistralai/Mistral-7B-Instruct-v0.3](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3) on a French legal question-answering dataset using LoRA (Low-Rank Adaptation).
20
+
21
+ ## Model Details
22
+ - **Repository:** [`Nahla-yasmine/mistral-7b-french-legal-qa`](https://huggingface.co/Nahla-yasmine/mistral-7b-french-legal-qa)
23
+ - **Base model:** [`mistralai/Mistral-7B-Instruct-v0.3`](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3)
24
+ - **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
25
+ - **Language**: 🇫🇷 French
26
+ - **Domain**: Legal Q&A
27
+ - **Training Dataset Size**: ~846 samples
28
+ - **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
29
+ - **Training Method**: QLoRA (4-bit quantization)
30
+
31
+
32
+
33
+ ## Model Description
34
+
35
+ This is a **LoRA fine-tuned adapter** for Mistral-7B-Instruct, trained on a curated **French legal question-answering** dataset focused on **data protection and privacy laws** (e.g., Law 18-07 in Algeria).
36
+
37
+ The goal is to assist users in understanding legal rights, definitions, and procedures related to personal data protection.
38
+
39
+ ---
40
+ ## LoRA Configuration
41
+
42
+ - **r**: 16
43
+ - **alpha**: 32
44
+ - **dropout**: 0.1
45
+ - **target_modules**: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
46
+
47
+
48
+ ## Usage
49
+
50
+ ### Quick Start
51
+
52
+ ```python
53
+ from transformers import AutoTokenizer, AutoModelForCausalLM
54
+ from peft import PeftModel
55
+ import torch
56
+
57
+ # Load tokenizer
58
+ tokenizer = AutoTokenizer.from_pretrained("Nahla-yasmine/mistral-7b-french-legal-qa")
59
+
60
+ # Load base model
61
+ base_model = AutoModelForCausalLM.from_pretrained(
62
+ "mistralai/Mistral-7B-Instruct-v0.3",
63
+ torch_dtype=torch.bfloat16,
64
+ device_map="auto"
65
+ )
66
+
67
+ # Load LoRA weights
68
+ model = PeftModel.from_pretrained(base_model, "Nahla-yasmine/mistral-7b-french-legal-qa")
69
+
70
+ # Generate response
71
+ def ask_question(question):
72
+ prompt = f"<s>[INST] {question} [/INST]"
73
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
74
+
75
+ with torch.no_grad():
76
+ outputs = model.generate(
77
+ **inputs,
78
+ max_new_tokens=200,
79
+ temperature=0.3,
80
+ top_p=0.9,
81
+ do_sample=True,
82
+ pad_token_id=tokenizer.eos_token_id
83
+ )
84
+
85
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
86
+ return response.split("[/INST]")[-1].strip()
87
+
88
+ # Example usage
89
+ question = "Qu'est-ce qu'une donnée à caractère personnel ?"
90
+ answer = ask_question(question)
91
+ print(f"Question: {question}")
92
+ print(f"Answer: {answer}")
93
+ ```
94
+
95
+ ### With Memory-Efficient Loading (4-bit quantization)
96
+
97
+ ```python
98
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
99
+ from peft import PeftModel
100
+ import torch
101
+
102
+ # Configure quantization
103
+ bnb_config = BitsAndBytesConfig(
104
+ load_in_4bit=True,
105
+ bnb_4bit_use_double_quant=True,
106
+ bnb_4bit_quant_type="nf4",
107
+ bnb_4bit_compute_dtype=torch.bfloat16
108
+ )
109
+
110
+ # Load with quantization
111
+ tokenizer = AutoTokenizer.from_pretrained("Nahla-yasmine/mistral-7b-french-legal-qa")
112
+ base_model = AutoModelForCausalLM.from_pretrained(
113
+ "mistralai/Mistral-7B-Instruct-v0.3",
114
+ quantization_config=bnb_config,
115
+ device_map="auto"
116
+ )
117
+ model = PeftModel.from_pretrained(base_model, "Nahla-yasmine/mistral-7b-french-legal-qa")
118
+ ```
119
+
120
+ ## Training Details
121
+
122
+ - **Epochs**: 3
123
+ - **Learning Rate**: 2e-4
124
+ - **Batch Size**: 2 (with gradient accumulation steps: 4)
125
+ - **Max Sequence Length**: 512 tokens
126
+ - **Optimizer**: paged_adamw_8bit
127
+ - **Warmup Ratio**: 0.1
128
+
129
+ ## Example Questions
130
+
131
+ The model can answer various French legal questions such as:
132
+
133
+ - "Qu'est-ce qu'une donnée à caractère personnel ?"
134
+ - "Quels sont les droits de la personne concernée ?"
135
+ - "Quelles sanctions s'appliquent en cas de non-respect de la loi 18-07 ?"
136
+ - "Comment exercer son droit de rectification ?"
137
+
138
+ ## Intended Use
139
+
140
+ This model is designed for answering questions about French legal topics, particularly data protection and privacy law. It should be used as a helpful assistant but **always verify important legal information with qualified professionals**.
141
+
142
+ ## Limitations
143
+
144
+ - The model is fine-tuned on a specific French legal dataset (protection de données) and may not generalize to all legal questions
145
+ - Responses should be verified by qualified legal professionals
146
+ - The model may occasionally generate inaccurate or incomplete information
147
+ - Limited to French legal context
148
+
149
+ ## Ethical Considerations
150
+
151
+ - This model provides general legal information and should not replace professional legal advice
152
+ - Users should verify all legal information with qualified professionals
153
+ - The model should not be used for making important legal decisions without proper review
154
+
155
+ ## Citation
156
+
157
+ If you use this model, please cite the original Mistral paper:
158
+
159
+ ```bibtex
160
+ @article{jiang2023mistral,
161
+ title={Mistral 7B},
162
+ author={Jiang, Albert Q and Sablayrolles, Alexandre and Mensch, Arthur and Bamford, Chris and Chaplot, Devendra Singh and Casas, Diego de las and Bressand, Florian and Lengyel, Gianna and Lample, Guillaume and Saulnier, Lucile and others},
163
+ journal={arXiv preprint arXiv:2310.06825},
164
+ year={2023}
165
+ }
166
+ ```
167
+
168
+ ## Contact
169
+
170
+ For questions about this fine-tuned model, please open an issue in this repository.
adapter_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": 32,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.1,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "r": 16,
24
+ "rank_pattern": {},
25
+ "revision": null,
26
+ "target_modules": [
27
+ "up_proj",
28
+ "down_proj",
29
+ "v_proj",
30
+ "o_proj",
31
+ "q_proj",
32
+ "gate_proj",
33
+ "k_proj"
34
+ ],
35
+ "task_type": "CAUSAL_LM",
36
+ "trainable_token_indices": null,
37
+ "use_dora": false,
38
+ "use_rslora": false
39
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:581f545e24424c3cfa007168a9f7ec58ef8741fcde7de3f9796fbe517081add2
3
+ size 167832240
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-100/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mistral-7B-Instruct-v0.3
3
+ library_name: peft
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
+
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]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.15.2.dev0
checkpoint-100/adapter_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": 32,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.1,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "r": 16,
24
+ "rank_pattern": {},
25
+ "revision": null,
26
+ "target_modules": [
27
+ "up_proj",
28
+ "down_proj",
29
+ "v_proj",
30
+ "o_proj",
31
+ "q_proj",
32
+ "gate_proj",
33
+ "k_proj"
34
+ ],
35
+ "task_type": "CAUSAL_LM",
36
+ "trainable_token_indices": null,
37
+ "use_dora": false,
38
+ "use_rslora": false
39
+ }
checkpoint-100/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:581f545e24424c3cfa007168a9f7ec58ef8741fcde7de3f9796fbe517081add2
3
+ size 167832240
checkpoint-100/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-100/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6bce12ec2b68d4f9f5d2a3f11b5d02d3a6523e9c394fe72ea89cab0311d1a05a
3
+ size 85728532
checkpoint-100/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78f03a7a1f25b6cf9ae264fc88e23d8fbaf1f1ae0f659075dba220f27316f309
3
+ size 14244
checkpoint-100/scaler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb51dd51bfb558b3f206b05041fcaa4338a055eef5e1abdec70763d503d3736a
3
+ size 988
checkpoint-100/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2700e157b43853522f7226ee750690132e80826b852b1c20900c3cd30bf4f6e
3
+ size 1064
checkpoint-100/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-100/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-100/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
3
+ size 587404
checkpoint-100/tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-100/trainer_state.json ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": 100,
3
+ "best_metric": 1.1341192722320557,
4
+ "best_model_checkpoint": "mistral-7b-frlegal-lora/checkpoint-100",
5
+ "epoch": 1.1775147928994083,
6
+ "eval_steps": 50,
7
+ "global_step": 100,
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.11834319526627218,
14
+ "grad_norm": 3.7848479747772217,
15
+ "learning_rate": 6.153846153846155e-05,
16
+ "loss": 2.8047,
17
+ "step": 10
18
+ },
19
+ {
20
+ "epoch": 0.23668639053254437,
21
+ "grad_norm": 3.650196075439453,
22
+ "learning_rate": 0.00013846153846153847,
23
+ "loss": 1.8139,
24
+ "step": 20
25
+ },
26
+ {
27
+ "epoch": 0.35502958579881655,
28
+ "grad_norm": 4.603827476501465,
29
+ "learning_rate": 0.00019912663755458515,
30
+ "loss": 1.5624,
31
+ "step": 30
32
+ },
33
+ {
34
+ "epoch": 0.47337278106508873,
35
+ "grad_norm": 3.440032482147217,
36
+ "learning_rate": 0.0001903930131004367,
37
+ "loss": 1.3397,
38
+ "step": 40
39
+ },
40
+ {
41
+ "epoch": 0.591715976331361,
42
+ "grad_norm": 4.5781025886535645,
43
+ "learning_rate": 0.00018165938864628822,
44
+ "loss": 1.2809,
45
+ "step": 50
46
+ },
47
+ {
48
+ "epoch": 0.591715976331361,
49
+ "eval_loss": 1.2312296628952026,
50
+ "eval_runtime": 60.6234,
51
+ "eval_samples_per_second": 2.788,
52
+ "eval_steps_per_second": 1.402,
53
+ "step": 50
54
+ },
55
+ {
56
+ "epoch": 0.7100591715976331,
57
+ "grad_norm": 3.0015316009521484,
58
+ "learning_rate": 0.00017292576419213976,
59
+ "loss": 1.1795,
60
+ "step": 60
61
+ },
62
+ {
63
+ "epoch": 0.8284023668639053,
64
+ "grad_norm": 2.660057544708252,
65
+ "learning_rate": 0.00016419213973799127,
66
+ "loss": 1.0804,
67
+ "step": 70
68
+ },
69
+ {
70
+ "epoch": 0.9467455621301775,
71
+ "grad_norm": 2.6601247787475586,
72
+ "learning_rate": 0.0001554585152838428,
73
+ "loss": 1.1704,
74
+ "step": 80
75
+ },
76
+ {
77
+ "epoch": 1.0591715976331362,
78
+ "grad_norm": 2.8257343769073486,
79
+ "learning_rate": 0.00014672489082969434,
80
+ "loss": 0.9553,
81
+ "step": 90
82
+ },
83
+ {
84
+ "epoch": 1.1775147928994083,
85
+ "grad_norm": 2.2877657413482666,
86
+ "learning_rate": 0.00013799126637554588,
87
+ "loss": 0.8022,
88
+ "step": 100
89
+ },
90
+ {
91
+ "epoch": 1.1775147928994083,
92
+ "eval_loss": 1.1341192722320557,
93
+ "eval_runtime": 60.7323,
94
+ "eval_samples_per_second": 2.783,
95
+ "eval_steps_per_second": 1.4,
96
+ "step": 100
97
+ }
98
+ ],
99
+ "logging_steps": 10,
100
+ "max_steps": 255,
101
+ "num_input_tokens_seen": 0,
102
+ "num_train_epochs": 3,
103
+ "save_steps": 100,
104
+ "stateful_callbacks": {
105
+ "TrainerControl": {
106
+ "args": {
107
+ "should_epoch_stop": false,
108
+ "should_evaluate": false,
109
+ "should_log": false,
110
+ "should_save": true,
111
+ "should_training_stop": false
112
+ },
113
+ "attributes": {}
114
+ }
115
+ },
116
+ "total_flos": 3181703551893504.0,
117
+ "train_batch_size": 2,
118
+ "trial_name": null,
119
+ "trial_params": null
120
+ }
checkpoint-100/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:622bfc5a9224860638ee74d7eedd0aad26fcad71dfb166cce64db1c74be39dcb
3
+ size 5304
checkpoint-255/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mistral-7B-Instruct-v0.3
3
+ library_name: peft
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
+
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]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.15.2.dev0
checkpoint-255/adapter_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": 32,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.1,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "r": 16,
24
+ "rank_pattern": {},
25
+ "revision": null,
26
+ "target_modules": [
27
+ "up_proj",
28
+ "down_proj",
29
+ "v_proj",
30
+ "o_proj",
31
+ "q_proj",
32
+ "gate_proj",
33
+ "k_proj"
34
+ ],
35
+ "task_type": "CAUSAL_LM",
36
+ "trainable_token_indices": null,
37
+ "use_dora": false,
38
+ "use_rslora": false
39
+ }
checkpoint-255/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32e07ed7cbe18dd32890a7e289b45f36cdebc961299b75939a87d3e8c9998901
3
+ size 167832240
checkpoint-255/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-255/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01dc40031d6d65db18cec84147e24569963aad2a4965ca6387b9ba128d832a39
3
+ size 85728532
checkpoint-255/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ac4408063bf1e24aad86fc32f6f019cb1b97ca56e2e58474bf0ccdc15186811
3
+ size 14244
checkpoint-255/scaler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f11a303f25dc4612a9dbe7c89e78ed1707bd664e8993a8169e84a46aa5b9415d
3
+ size 988
checkpoint-255/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:720eb295c27f950bba892740679dc26bc4f4d3905cfd391f459eb532ef73fde6
3
+ size 1064
checkpoint-255/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-255/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-255/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
3
+ size 587404
checkpoint-255/tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-255/trainer_state.json ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": 150,
3
+ "best_metric": 1.1094907522201538,
4
+ "best_model_checkpoint": "mistral-7b-frlegal-lora/checkpoint-100",
5
+ "epoch": 3.0,
6
+ "eval_steps": 50,
7
+ "global_step": 255,
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.11834319526627218,
14
+ "grad_norm": 3.7848479747772217,
15
+ "learning_rate": 6.153846153846155e-05,
16
+ "loss": 2.8047,
17
+ "step": 10
18
+ },
19
+ {
20
+ "epoch": 0.23668639053254437,
21
+ "grad_norm": 3.650196075439453,
22
+ "learning_rate": 0.00013846153846153847,
23
+ "loss": 1.8139,
24
+ "step": 20
25
+ },
26
+ {
27
+ "epoch": 0.35502958579881655,
28
+ "grad_norm": 4.603827476501465,
29
+ "learning_rate": 0.00019912663755458515,
30
+ "loss": 1.5624,
31
+ "step": 30
32
+ },
33
+ {
34
+ "epoch": 0.47337278106508873,
35
+ "grad_norm": 3.440032482147217,
36
+ "learning_rate": 0.0001903930131004367,
37
+ "loss": 1.3397,
38
+ "step": 40
39
+ },
40
+ {
41
+ "epoch": 0.591715976331361,
42
+ "grad_norm": 4.5781025886535645,
43
+ "learning_rate": 0.00018165938864628822,
44
+ "loss": 1.2809,
45
+ "step": 50
46
+ },
47
+ {
48
+ "epoch": 0.591715976331361,
49
+ "eval_loss": 1.2312296628952026,
50
+ "eval_runtime": 60.6234,
51
+ "eval_samples_per_second": 2.788,
52
+ "eval_steps_per_second": 1.402,
53
+ "step": 50
54
+ },
55
+ {
56
+ "epoch": 0.7100591715976331,
57
+ "grad_norm": 3.0015316009521484,
58
+ "learning_rate": 0.00017292576419213976,
59
+ "loss": 1.1795,
60
+ "step": 60
61
+ },
62
+ {
63
+ "epoch": 0.8284023668639053,
64
+ "grad_norm": 2.660057544708252,
65
+ "learning_rate": 0.00016419213973799127,
66
+ "loss": 1.0804,
67
+ "step": 70
68
+ },
69
+ {
70
+ "epoch": 0.9467455621301775,
71
+ "grad_norm": 2.6601247787475586,
72
+ "learning_rate": 0.0001554585152838428,
73
+ "loss": 1.1704,
74
+ "step": 80
75
+ },
76
+ {
77
+ "epoch": 1.0591715976331362,
78
+ "grad_norm": 2.8257343769073486,
79
+ "learning_rate": 0.00014672489082969434,
80
+ "loss": 0.9553,
81
+ "step": 90
82
+ },
83
+ {
84
+ "epoch": 1.1775147928994083,
85
+ "grad_norm": 2.2877657413482666,
86
+ "learning_rate": 0.00013799126637554588,
87
+ "loss": 0.8022,
88
+ "step": 100
89
+ },
90
+ {
91
+ "epoch": 1.1775147928994083,
92
+ "eval_loss": 1.1341192722320557,
93
+ "eval_runtime": 60.7323,
94
+ "eval_samples_per_second": 2.783,
95
+ "eval_steps_per_second": 1.4,
96
+ "step": 100
97
+ },
98
+ {
99
+ "epoch": 1.2958579881656804,
100
+ "grad_norm": 2.4518744945526123,
101
+ "learning_rate": 0.00012925764192139738,
102
+ "loss": 0.7463,
103
+ "step": 110
104
+ },
105
+ {
106
+ "epoch": 1.4142011834319526,
107
+ "grad_norm": 2.634495735168457,
108
+ "learning_rate": 0.0001205240174672489,
109
+ "loss": 0.7574,
110
+ "step": 120
111
+ },
112
+ {
113
+ "epoch": 1.532544378698225,
114
+ "grad_norm": 2.428051710128784,
115
+ "learning_rate": 0.00011179039301310044,
116
+ "loss": 0.7658,
117
+ "step": 130
118
+ },
119
+ {
120
+ "epoch": 1.650887573964497,
121
+ "grad_norm": 2.903827667236328,
122
+ "learning_rate": 0.00010305676855895196,
123
+ "loss": 0.7334,
124
+ "step": 140
125
+ },
126
+ {
127
+ "epoch": 1.7692307692307692,
128
+ "grad_norm": 2.4579429626464844,
129
+ "learning_rate": 9.43231441048035e-05,
130
+ "loss": 0.7041,
131
+ "step": 150
132
+ },
133
+ {
134
+ "epoch": 1.7692307692307692,
135
+ "eval_loss": 1.1094907522201538,
136
+ "eval_runtime": 60.6543,
137
+ "eval_samples_per_second": 2.786,
138
+ "eval_steps_per_second": 1.401,
139
+ "step": 150
140
+ },
141
+ {
142
+ "epoch": 1.8875739644970415,
143
+ "grad_norm": 2.4557547569274902,
144
+ "learning_rate": 8.558951965065502e-05,
145
+ "loss": 0.7263,
146
+ "step": 160
147
+ },
148
+ {
149
+ "epoch": 2.0,
150
+ "grad_norm": 2.915830135345459,
151
+ "learning_rate": 7.685589519650656e-05,
152
+ "loss": 0.784,
153
+ "step": 170
154
+ },
155
+ {
156
+ "epoch": 2.1183431952662723,
157
+ "grad_norm": 3.7625837326049805,
158
+ "learning_rate": 6.812227074235808e-05,
159
+ "loss": 0.4613,
160
+ "step": 180
161
+ },
162
+ {
163
+ "epoch": 2.2366863905325443,
164
+ "grad_norm": 2.049013376235962,
165
+ "learning_rate": 5.9388646288209616e-05,
166
+ "loss": 0.4533,
167
+ "step": 190
168
+ },
169
+ {
170
+ "epoch": 2.3550295857988166,
171
+ "grad_norm": 1.8300621509552002,
172
+ "learning_rate": 5.065502183406113e-05,
173
+ "loss": 0.456,
174
+ "step": 200
175
+ },
176
+ {
177
+ "epoch": 2.3550295857988166,
178
+ "eval_loss": 1.1557873487472534,
179
+ "eval_runtime": 60.6355,
180
+ "eval_samples_per_second": 2.787,
181
+ "eval_steps_per_second": 1.402,
182
+ "step": 200
183
+ },
184
+ {
185
+ "epoch": 2.4733727810650885,
186
+ "grad_norm": 1.6030356884002686,
187
+ "learning_rate": 4.192139737991266e-05,
188
+ "loss": 0.4833,
189
+ "step": 210
190
+ },
191
+ {
192
+ "epoch": 2.591715976331361,
193
+ "grad_norm": 2.6860575675964355,
194
+ "learning_rate": 3.3187772925764197e-05,
195
+ "loss": 0.5044,
196
+ "step": 220
197
+ },
198
+ {
199
+ "epoch": 2.710059171597633,
200
+ "grad_norm": 2.007375955581665,
201
+ "learning_rate": 2.445414847161572e-05,
202
+ "loss": 0.4456,
203
+ "step": 230
204
+ },
205
+ {
206
+ "epoch": 2.828402366863905,
207
+ "grad_norm": 1.3755784034729004,
208
+ "learning_rate": 1.572052401746725e-05,
209
+ "loss": 0.4325,
210
+ "step": 240
211
+ },
212
+ {
213
+ "epoch": 2.9467455621301775,
214
+ "grad_norm": 2.183783769607544,
215
+ "learning_rate": 6.986899563318778e-06,
216
+ "loss": 0.4677,
217
+ "step": 250
218
+ },
219
+ {
220
+ "epoch": 2.9467455621301775,
221
+ "eval_loss": 1.1586920022964478,
222
+ "eval_runtime": 60.6003,
223
+ "eval_samples_per_second": 2.789,
224
+ "eval_steps_per_second": 1.403,
225
+ "step": 250
226
+ }
227
+ ],
228
+ "logging_steps": 10,
229
+ "max_steps": 255,
230
+ "num_input_tokens_seen": 0,
231
+ "num_train_epochs": 3,
232
+ "save_steps": 100,
233
+ "stateful_callbacks": {
234
+ "TrainerControl": {
235
+ "args": {
236
+ "should_epoch_stop": false,
237
+ "should_evaluate": false,
238
+ "should_log": false,
239
+ "should_save": true,
240
+ "should_training_stop": true
241
+ },
242
+ "attributes": {}
243
+ }
244
+ },
245
+ "total_flos": 8132308222967808.0,
246
+ "train_batch_size": 2,
247
+ "trial_name": null,
248
+ "trial_params": null
249
+ }
checkpoint-255/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:622bfc5a9224860638ee74d7eedd0aad26fcad71dfb166cce64db1c74be39dcb
3
+ size 5304
evaluation_results.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "pre_training_scores": {
3
+ "rouge1": 0.15518679118679118,
4
+ "rouge2": 0.04633460753414803,
5
+ "rougeL": 0.11591081191081191
6
+ },
7
+ "post_training_scores": {
8
+ "rouge1": 0.2716337018781402,
9
+ "rouge2": 0.1255309359708316,
10
+ "rougeL": 0.20557982875080252
11
+ },
12
+ "improvement": {
13
+ "rouge1": 0.11644691069134899,
14
+ "rouge2": 0.07919632843668356,
15
+ "rougeL": 0.08966901683999061
16
+ }
17
+ }
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:622bfc5a9224860638ee74d7eedd0aad26fcad71dfb166cce64db1c74be39dcb
3
+ size 5304