Frinkles commited on
Commit
243a9dd
·
1 Parent(s): 97c411f

debuggin memory leak in notebook...

Browse files
.gitattributes CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
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
@@ -33,10 +44,8 @@ saved_model/**/* 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
36
- # Auto detect text files and perform LF to CRLF conversion for Windows
37
- * text=auto
38
 
39
- # Handle specific file types
40
  *.ipynb text eol=lf
41
  *.json text eol=lf
42
  *.py text eol=lf
 
1
+ # Treat all text files as text and auto-detect line endings
2
+ * text=auto
3
+
4
+ # Specific handling for different file types
5
+ *.md text eol=lf
6
+ *.json text eol=lf
7
+ *.bin binary
8
+ *.pt binary
9
+ *.pth binary
10
+
11
+ # Existing binary file types with LFS
12
  *.7z filter=lfs diff=lfs merge=lfs -text
13
  *.arrow filter=lfs diff=lfs merge=lfs -text
14
  *.bin filter=lfs diff=lfs merge=lfs -text
 
44
  *.zip filter=lfs diff=lfs merge=lfs -text
45
  *.zst filter=lfs diff=lfs merge=lfs -text
46
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
47
 
48
+ # Specific file types to use LF line endings
49
  *.ipynb text eol=lf
50
  *.json text eol=lf
51
  *.py text eol=lf
checkpoint_dir/checkpoint-1200/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: microsoft/Phi-3-mini-4k-instruct
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.11.1
checkpoint_dir/checkpoint-1200/adapter_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "microsoft/Phi-3-mini-4k-instruct",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.05,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 16,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "qkv_proj",
24
+ "gate_up_proj",
25
+ "o_proj",
26
+ "down_proj"
27
+ ],
28
+ "task_type": "CAUSAL_LM",
29
+ "use_dora": false,
30
+ "use_rslora": false
31
+ }
checkpoint_dir/checkpoint-1200/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:509e03e583766096cb2af316df026b5160028032ac428d01fc9ab3221c1165e7
3
+ size 50366024
checkpoint_dir/checkpoint-1200/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9643de235a33a2501cf495a506083c7277f374bcfbe93c717fa09b2e9edcbedd
3
+ size 100878458
checkpoint_dir/checkpoint-1200/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb6f83e7b0b934716a93a31924ee6f0df61bfca245f9915406b8453534851a41
3
+ size 14180
checkpoint_dir/checkpoint-1200/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5683ab95794a7a05318f91f170307760f847ea5b44bfa96e35dd99041b516c87
3
+ size 1064
checkpoint_dir/checkpoint-1200/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": "<|endoftext|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "<unk>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
checkpoint_dir/checkpoint-1200/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint_dir/checkpoint-1200/tokenizer_config.json ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": true,
26
+ "single_word": false,
27
+ "special": false
28
+ },
29
+ "32000": {
30
+ "content": "<|endoftext|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "32001": {
38
+ "content": "<|assistant|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": true,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "32002": {
46
+ "content": "<|placeholder1|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": true,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "32003": {
54
+ "content": "<|placeholder2|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": true,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "32004": {
62
+ "content": "<|placeholder3|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": true,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "32005": {
70
+ "content": "<|placeholder4|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": true,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "32006": {
78
+ "content": "<|system|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": true,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "32007": {
86
+ "content": "<|end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": true,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "32008": {
94
+ "content": "<|placeholder5|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": true,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "32009": {
102
+ "content": "<|placeholder6|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": true,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "32010": {
110
+ "content": "<|user|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": true,
114
+ "single_word": false,
115
+ "special": true
116
+ }
117
+ },
118
+ "bos_token": "<s>",
119
+ "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') %}{{'<|user|>' + '\n' + message['content'] + '<|end|>' + '\n' + '<|assistant|>' + '\n'}}{% elif (message['role'] == 'assistant') %}{{message['content'] + '<|end|>' + '\n'}}{% endif %}{% endfor %}",
120
+ "clean_up_tokenization_spaces": false,
121
+ "eos_token": "<|endoftext|>",
122
+ "model_max_length": 2048,
123
+ "pad_token": "<unk>",
124
+ "padding_side": "right",
125
+ "sp_model_kwargs": {},
126
+ "tokenizer_class": "LlamaTokenizer",
127
+ "unk_token": "<unk>",
128
+ "use_default_system_prompt": false
129
+ }
checkpoint_dir/checkpoint-1200/trainer_state.json ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.01710376282782212,
5
+ "eval_steps": 500,
6
+ "global_step": 1200,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.00028506271379703536,
13
+ "grad_norm": NaN,
14
+ "learning_rate": 7.126567844925884e-09,
15
+ "loss": 0.7555,
16
+ "step": 20
17
+ },
18
+ {
19
+ "epoch": 0.0005701254275940707,
20
+ "grad_norm": NaN,
21
+ "learning_rate": 1.4253135689851768e-08,
22
+ "loss": 0.0,
23
+ "step": 40
24
+ },
25
+ {
26
+ "epoch": 0.0008551881413911061,
27
+ "grad_norm": NaN,
28
+ "learning_rate": 2.1379703534777654e-08,
29
+ "loss": 0.0,
30
+ "step": 60
31
+ },
32
+ {
33
+ "epoch": 0.0011402508551881414,
34
+ "grad_norm": NaN,
35
+ "learning_rate": 2.8506271379703537e-08,
36
+ "loss": 0.0,
37
+ "step": 80
38
+ },
39
+ {
40
+ "epoch": 0.0014253135689851768,
41
+ "grad_norm": NaN,
42
+ "learning_rate": 3.563283922462942e-08,
43
+ "loss": 0.0,
44
+ "step": 100
45
+ },
46
+ {
47
+ "epoch": 0.0017103762827822121,
48
+ "grad_norm": NaN,
49
+ "learning_rate": 4.275940706955531e-08,
50
+ "loss": 0.0,
51
+ "step": 120
52
+ },
53
+ {
54
+ "epoch": 0.0019954389965792475,
55
+ "grad_norm": NaN,
56
+ "learning_rate": 4.988597491448119e-08,
57
+ "loss": 0.0,
58
+ "step": 140
59
+ },
60
+ {
61
+ "epoch": 0.002280501710376283,
62
+ "grad_norm": NaN,
63
+ "learning_rate": 5.701254275940707e-08,
64
+ "loss": 0.0,
65
+ "step": 160
66
+ },
67
+ {
68
+ "epoch": 0.002565564424173318,
69
+ "grad_norm": NaN,
70
+ "learning_rate": 6.413911060433296e-08,
71
+ "loss": 0.0,
72
+ "step": 180
73
+ },
74
+ {
75
+ "epoch": 0.0028506271379703536,
76
+ "grad_norm": NaN,
77
+ "learning_rate": 7.126567844925884e-08,
78
+ "loss": 0.0,
79
+ "step": 200
80
+ },
81
+ {
82
+ "epoch": 0.003135689851767389,
83
+ "grad_norm": NaN,
84
+ "learning_rate": 7.839224629418473e-08,
85
+ "loss": 0.0,
86
+ "step": 220
87
+ },
88
+ {
89
+ "epoch": 0.0034207525655644243,
90
+ "grad_norm": NaN,
91
+ "learning_rate": 8.551881413911062e-08,
92
+ "loss": 0.0,
93
+ "step": 240
94
+ },
95
+ {
96
+ "epoch": 0.0037058152793614596,
97
+ "grad_norm": NaN,
98
+ "learning_rate": 9.264538198403649e-08,
99
+ "loss": 0.0,
100
+ "step": 260
101
+ },
102
+ {
103
+ "epoch": 0.003990877993158495,
104
+ "grad_norm": NaN,
105
+ "learning_rate": 9.977194982896237e-08,
106
+ "loss": 0.0,
107
+ "step": 280
108
+ },
109
+ {
110
+ "epoch": 0.00427594070695553,
111
+ "grad_norm": NaN,
112
+ "learning_rate": 1.0689851767388827e-07,
113
+ "loss": 0.0,
114
+ "step": 300
115
+ },
116
+ {
117
+ "epoch": 0.004561003420752566,
118
+ "grad_norm": NaN,
119
+ "learning_rate": 1.1402508551881415e-07,
120
+ "loss": 0.0,
121
+ "step": 320
122
+ },
123
+ {
124
+ "epoch": 0.004846066134549601,
125
+ "grad_norm": NaN,
126
+ "learning_rate": 1.2115165336374005e-07,
127
+ "loss": 0.0,
128
+ "step": 340
129
+ },
130
+ {
131
+ "epoch": 0.005131128848346636,
132
+ "grad_norm": NaN,
133
+ "learning_rate": 1.2827822120866592e-07,
134
+ "loss": 0.0,
135
+ "step": 360
136
+ },
137
+ {
138
+ "epoch": 0.005416191562143672,
139
+ "grad_norm": NaN,
140
+ "learning_rate": 1.3540478905359182e-07,
141
+ "loss": 0.0,
142
+ "step": 380
143
+ },
144
+ {
145
+ "epoch": 0.005701254275940707,
146
+ "grad_norm": NaN,
147
+ "learning_rate": 1.425313568985177e-07,
148
+ "loss": 0.0,
149
+ "step": 400
150
+ },
151
+ {
152
+ "epoch": 0.0059863169897377425,
153
+ "grad_norm": NaN,
154
+ "learning_rate": 1.4965792474344356e-07,
155
+ "loss": 0.0,
156
+ "step": 420
157
+ },
158
+ {
159
+ "epoch": 0.006271379703534778,
160
+ "grad_norm": NaN,
161
+ "learning_rate": 1.5678449258836946e-07,
162
+ "loss": 0.0,
163
+ "step": 440
164
+ },
165
+ {
166
+ "epoch": 0.006556442417331813,
167
+ "grad_norm": NaN,
168
+ "learning_rate": 1.6391106043329536e-07,
169
+ "loss": 0.0,
170
+ "step": 460
171
+ },
172
+ {
173
+ "epoch": 0.0068415051311288486,
174
+ "grad_norm": NaN,
175
+ "learning_rate": 1.7103762827822123e-07,
176
+ "loss": 0.0,
177
+ "step": 480
178
+ },
179
+ {
180
+ "epoch": 0.007126567844925884,
181
+ "grad_norm": NaN,
182
+ "learning_rate": 1.781641961231471e-07,
183
+ "loss": 0.0,
184
+ "step": 500
185
+ },
186
+ {
187
+ "epoch": 0.007411630558722919,
188
+ "grad_norm": NaN,
189
+ "learning_rate": 1.8529076396807298e-07,
190
+ "loss": 0.0,
191
+ "step": 520
192
+ },
193
+ {
194
+ "epoch": 0.007696693272519955,
195
+ "grad_norm": NaN,
196
+ "learning_rate": 1.9241733181299888e-07,
197
+ "loss": 0.0,
198
+ "step": 540
199
+ },
200
+ {
201
+ "epoch": 0.00798175598631699,
202
+ "grad_norm": NaN,
203
+ "learning_rate": 1.9954389965792475e-07,
204
+ "loss": 0.0,
205
+ "step": 560
206
+ },
207
+ {
208
+ "epoch": 0.008266818700114024,
209
+ "grad_norm": NaN,
210
+ "learning_rate": 2.0667046750285062e-07,
211
+ "loss": 0.0,
212
+ "step": 580
213
+ },
214
+ {
215
+ "epoch": 0.00855188141391106,
216
+ "grad_norm": NaN,
217
+ "learning_rate": 2.1379703534777655e-07,
218
+ "loss": 0.0,
219
+ "step": 600
220
+ },
221
+ {
222
+ "epoch": 0.008836944127708095,
223
+ "grad_norm": NaN,
224
+ "learning_rate": 2.2092360319270242e-07,
225
+ "loss": 0.0,
226
+ "step": 620
227
+ },
228
+ {
229
+ "epoch": 0.009122006841505131,
230
+ "grad_norm": NaN,
231
+ "learning_rate": 2.280501710376283e-07,
232
+ "loss": 0.0,
233
+ "step": 640
234
+ },
235
+ {
236
+ "epoch": 0.009407069555302166,
237
+ "grad_norm": NaN,
238
+ "learning_rate": 2.351767388825542e-07,
239
+ "loss": 0.0,
240
+ "step": 660
241
+ },
242
+ {
243
+ "epoch": 0.009692132269099202,
244
+ "grad_norm": NaN,
245
+ "learning_rate": 2.423033067274801e-07,
246
+ "loss": 0.0,
247
+ "step": 680
248
+ },
249
+ {
250
+ "epoch": 0.009977194982896237,
251
+ "grad_norm": NaN,
252
+ "learning_rate": 2.4942987457240596e-07,
253
+ "loss": 0.0,
254
+ "step": 700
255
+ },
256
+ {
257
+ "epoch": 0.010262257696693273,
258
+ "grad_norm": NaN,
259
+ "learning_rate": 2.5655644241733184e-07,
260
+ "loss": 0.0,
261
+ "step": 720
262
+ },
263
+ {
264
+ "epoch": 0.010547320410490307,
265
+ "grad_norm": NaN,
266
+ "learning_rate": 2.636830102622577e-07,
267
+ "loss": 0.0,
268
+ "step": 740
269
+ },
270
+ {
271
+ "epoch": 0.010832383124287344,
272
+ "grad_norm": NaN,
273
+ "learning_rate": 2.7080957810718363e-07,
274
+ "loss": 0.0,
275
+ "step": 760
276
+ },
277
+ {
278
+ "epoch": 0.011117445838084378,
279
+ "grad_norm": NaN,
280
+ "learning_rate": 2.779361459521095e-07,
281
+ "loss": 0.0,
282
+ "step": 780
283
+ },
284
+ {
285
+ "epoch": 0.011402508551881414,
286
+ "grad_norm": NaN,
287
+ "learning_rate": 2.850627137970354e-07,
288
+ "loss": 0.0,
289
+ "step": 800
290
+ },
291
+ {
292
+ "epoch": 0.011687571265678449,
293
+ "grad_norm": NaN,
294
+ "learning_rate": 2.9218928164196125e-07,
295
+ "loss": 0.0,
296
+ "step": 820
297
+ },
298
+ {
299
+ "epoch": 0.011972633979475485,
300
+ "grad_norm": NaN,
301
+ "learning_rate": 2.993158494868871e-07,
302
+ "loss": 0.0,
303
+ "step": 840
304
+ },
305
+ {
306
+ "epoch": 0.01225769669327252,
307
+ "grad_norm": NaN,
308
+ "learning_rate": 3.06442417331813e-07,
309
+ "loss": 0.0,
310
+ "step": 860
311
+ },
312
+ {
313
+ "epoch": 0.012542759407069556,
314
+ "grad_norm": NaN,
315
+ "learning_rate": 3.135689851767389e-07,
316
+ "loss": 0.0,
317
+ "step": 880
318
+ },
319
+ {
320
+ "epoch": 0.01282782212086659,
321
+ "grad_norm": NaN,
322
+ "learning_rate": 3.206955530216648e-07,
323
+ "loss": 0.0,
324
+ "step": 900
325
+ },
326
+ {
327
+ "epoch": 0.013112884834663626,
328
+ "grad_norm": NaN,
329
+ "learning_rate": 3.278221208665907e-07,
330
+ "loss": 0.0,
331
+ "step": 920
332
+ },
333
+ {
334
+ "epoch": 0.013397947548460661,
335
+ "grad_norm": NaN,
336
+ "learning_rate": 3.349486887115166e-07,
337
+ "loss": 0.0,
338
+ "step": 940
339
+ },
340
+ {
341
+ "epoch": 0.013683010262257697,
342
+ "grad_norm": NaN,
343
+ "learning_rate": 3.4207525655644247e-07,
344
+ "loss": 0.0,
345
+ "step": 960
346
+ },
347
+ {
348
+ "epoch": 0.013968072976054732,
349
+ "grad_norm": NaN,
350
+ "learning_rate": 3.4920182440136834e-07,
351
+ "loss": 0.0,
352
+ "step": 980
353
+ },
354
+ {
355
+ "epoch": 0.014253135689851768,
356
+ "grad_norm": NaN,
357
+ "learning_rate": 3.563283922462942e-07,
358
+ "loss": 0.0,
359
+ "step": 1000
360
+ },
361
+ {
362
+ "epoch": 0.014538198403648802,
363
+ "grad_norm": NaN,
364
+ "learning_rate": 3.634549600912201e-07,
365
+ "loss": 0.0,
366
+ "step": 1020
367
+ },
368
+ {
369
+ "epoch": 0.014823261117445839,
370
+ "grad_norm": NaN,
371
+ "learning_rate": 3.7058152793614596e-07,
372
+ "loss": 0.0,
373
+ "step": 1040
374
+ },
375
+ {
376
+ "epoch": 0.015108323831242873,
377
+ "grad_norm": NaN,
378
+ "learning_rate": 3.777080957810719e-07,
379
+ "loss": 0.0,
380
+ "step": 1060
381
+ },
382
+ {
383
+ "epoch": 0.01539338654503991,
384
+ "grad_norm": NaN,
385
+ "learning_rate": 3.8483466362599775e-07,
386
+ "loss": 0.0,
387
+ "step": 1080
388
+ },
389
+ {
390
+ "epoch": 0.015678449258836945,
391
+ "grad_norm": NaN,
392
+ "learning_rate": 3.919612314709236e-07,
393
+ "loss": 0.0,
394
+ "step": 1100
395
+ },
396
+ {
397
+ "epoch": 0.01596351197263398,
398
+ "grad_norm": NaN,
399
+ "learning_rate": 3.990877993158495e-07,
400
+ "loss": 0.0,
401
+ "step": 1120
402
+ },
403
+ {
404
+ "epoch": 0.016248574686431014,
405
+ "grad_norm": NaN,
406
+ "learning_rate": 4.0621436716077537e-07,
407
+ "loss": 0.0,
408
+ "step": 1140
409
+ },
410
+ {
411
+ "epoch": 0.01653363740022805,
412
+ "grad_norm": NaN,
413
+ "learning_rate": 4.1334093500570124e-07,
414
+ "loss": 0.0,
415
+ "step": 1160
416
+ },
417
+ {
418
+ "epoch": 0.016818700114025087,
419
+ "grad_norm": NaN,
420
+ "learning_rate": 4.204675028506271e-07,
421
+ "loss": 0.0,
422
+ "step": 1180
423
+ },
424
+ {
425
+ "epoch": 0.01710376282782212,
426
+ "grad_norm": NaN,
427
+ "learning_rate": 4.275940706955531e-07,
428
+ "loss": 0.0,
429
+ "step": 1200
430
+ }
431
+ ],
432
+ "logging_steps": 20,
433
+ "max_steps": 70160,
434
+ "num_input_tokens_seen": 0,
435
+ "num_train_epochs": 1,
436
+ "save_steps": 100,
437
+ "stateful_callbacks": {
438
+ "TrainerControl": {
439
+ "args": {
440
+ "should_epoch_stop": false,
441
+ "should_evaluate": false,
442
+ "should_log": false,
443
+ "should_save": true,
444
+ "should_training_stop": false
445
+ },
446
+ "attributes": {}
447
+ }
448
+ },
449
+ "total_flos": 1.105254905020416e+17,
450
+ "train_batch_size": 2,
451
+ "trial_name": null,
452
+ "trial_params": null
453
+ }
checkpoint_dir/checkpoint-1200/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa52f43a2566203d13a960b76a6ee31b373d6f336edbcfc792f40231efec3b62
3
+ size 5112
trainingNotebook.ipynb ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 2,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import sys\n",
10
+ "# import logging\n",
11
+ "\n",
12
+ "import datasets\n",
13
+ "from datasets import load_dataset\n",
14
+ "from peft import LoraConfig\n",
15
+ "import torch\n",
16
+ "import transformers\n",
17
+ "from trl import SFTTrainer\n",
18
+ "from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, BitsAndBytesConfig\n"
19
+ ]
20
+ },
21
+ {
22
+ "cell_type": "code",
23
+ "execution_count": 3,
24
+ "metadata": {},
25
+ "outputs": [],
26
+ "source": [
27
+ "training_config = {\n",
28
+ " \"bf16\": False,\n",
29
+ " \"do_eval\": False,\n",
30
+ " \"learning_rate\": 5.0e-06,\n",
31
+ " \"log_level\": \"info\",\n",
32
+ " \"logging_steps\": 20,\n",
33
+ " \"logging_strategy\": \"steps\",\n",
34
+ " \"lr_scheduler_type\": \"cosine\",\n",
35
+ " \"num_train_epochs\": 1,\n",
36
+ " \"max_steps\": -1,\n",
37
+ " \"output_dir\": \"./checkpoint_dir\",\n",
38
+ " \"overwrite_output_dir\": True,\n",
39
+ " \"per_device_eval_batch_size\": 2, # Reduce batch size to lower memory usage\n",
40
+ " \"per_device_train_batch_size\": 2, # Reduce batch size to lower memory usage\n",
41
+ " \"remove_unused_columns\": True,\n",
42
+ " \"save_steps\": 100,\n",
43
+ " \"save_total_limit\": 1,\n",
44
+ " \"seed\": 0,\n",
45
+ " \"gradient_checkpointing\": True,\n",
46
+ " \"gradient_checkpointing_kwargs\":{\"use_reentrant\": False},\n",
47
+ " \"gradient_accumulation_steps\": 1,\n",
48
+ " \"warmup_ratio\": 0.2,\n",
49
+ "}\n",
50
+ "\n",
51
+ "peft_config = {\n",
52
+ " \"r\": 16,\n",
53
+ " \"lora_alpha\": 32,\n",
54
+ " \"lora_dropout\": 0.05,\n",
55
+ " \"bias\": \"none\",\n",
56
+ " \"task_type\": \"CAUSAL_LM\",\n",
57
+ " \"target_modules\": \"all-linear\",\n",
58
+ " \"modules_to_save\": None,\n",
59
+ "}\n",
60
+ "train_conf = TrainingArguments(**training_config)\n",
61
+ "peft_conf = LoraConfig(**peft_config)"
62
+ ]
63
+ },
64
+ {
65
+ "cell_type": "code",
66
+ "execution_count": 4,
67
+ "metadata": {},
68
+ "outputs": [
69
+ {
70
+ "name": "stderr",
71
+ "output_type": "stream",
72
+ "text": [
73
+ "You are attempting to use Flash Attention 2.0 with a model not initialized on GPU. Make sure to move the model to GPU after initializing it on CPU with `model.to('cuda')`.\n",
74
+ "Loading checkpoint shards: 100%|██████████| 2/2 [01:34<00:00, 47.42s/it]\n",
75
+ "Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n"
76
+ ]
77
+ },
78
+ {
79
+ "data": {
80
+ "text/plain": [
81
+ "Phi3ForCausalLM(\n",
82
+ " (model): Phi3Model(\n",
83
+ " (embed_tokens): Embedding(32064, 3072, padding_idx=32000)\n",
84
+ " (embed_dropout): Dropout(p=0.0, inplace=False)\n",
85
+ " (layers): ModuleList(\n",
86
+ " (0-31): 32 x Phi3DecoderLayer(\n",
87
+ " (self_attn): Phi3FlashAttention2(\n",
88
+ " (o_proj): Linear(in_features=3072, out_features=3072, bias=False)\n",
89
+ " (qkv_proj): Linear(in_features=3072, out_features=9216, bias=False)\n",
90
+ " (rotary_emb): Phi3RotaryEmbedding()\n",
91
+ " )\n",
92
+ " (mlp): Phi3MLP(\n",
93
+ " (gate_up_proj): Linear(in_features=3072, out_features=16384, bias=False)\n",
94
+ " (down_proj): Linear(in_features=8192, out_features=3072, bias=False)\n",
95
+ " (activation_fn): SiLU()\n",
96
+ " )\n",
97
+ " (input_layernorm): Phi3RMSNorm()\n",
98
+ " (resid_attn_dropout): Dropout(p=0.0, inplace=False)\n",
99
+ " (resid_mlp_dropout): Dropout(p=0.0, inplace=False)\n",
100
+ " (post_attention_layernorm): Phi3RMSNorm()\n",
101
+ " )\n",
102
+ " )\n",
103
+ " (norm): Phi3RMSNorm()\n",
104
+ " )\n",
105
+ " (lm_head): Linear(in_features=3072, out_features=32064, bias=False)\n",
106
+ ")"
107
+ ]
108
+ },
109
+ "execution_count": 4,
110
+ "metadata": {},
111
+ "output_type": "execute_result"
112
+ }
113
+ ],
114
+ "source": [
115
+ "################\n",
116
+ "# Model Loading\n",
117
+ "################\n",
118
+ "checkpoint_path = \"microsoft/Phi-3-mini-4k-instruct\"\n",
119
+ "# checkpoint_path = \"microsoft/Phi-3-mini-128k-instruct\"\n",
120
+ "model_kwargs = dict(\n",
121
+ " use_cache=False,\n",
122
+ " trust_remote_code=True,\n",
123
+ " attn_implementation=\"flash_attention_2\", # loading the model with flash-attention support\n",
124
+ " torch_dtype=torch.float16, # Changed to float16\n",
125
+ " device_map=None\n",
126
+ ")\n",
127
+ "model = AutoModelForCausalLM.from_pretrained(checkpoint_path, **model_kwargs)\n",
128
+ "tokenizer = AutoTokenizer.from_pretrained(checkpoint_path)\n",
129
+ "tokenizer.model_max_length = 2048\n",
130
+ "tokenizer.pad_token = tokenizer.unk_token # use unk rather than eos token to prevent endless generation\n",
131
+ "tokenizer.pad_token_id = tokenizer.convert_tokens_to_ids(tokenizer.pad_token)\n",
132
+ "tokenizer.padding_side = 'right'\n",
133
+ "\n",
134
+ "# Move the model to GPU\n",
135
+ "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
136
+ "model.to(device)"
137
+ ]
138
+ },
139
+ {
140
+ "cell_type": "code",
141
+ "execution_count": 5,
142
+ "metadata": {},
143
+ "outputs": [
144
+ {
145
+ "name": "stderr",
146
+ "output_type": "stream",
147
+ "text": [
148
+ "Applying chat template to train_sft (num_proc=10): 100%|██████████| 207865/207865 [00:05<00:00, 37564.48 examples/s] \n",
149
+ "Applying chat template to test_sft (num_proc=10): 100%|██████████| 23110/23110 [00:03<00:00, 7597.23 examples/s] \n"
150
+ ]
151
+ }
152
+ ],
153
+ "source": [
154
+ "##################\n",
155
+ "# Data Processing\n",
156
+ "##################\n",
157
+ "def apply_chat_template(example, tokenizer):\n",
158
+ " messages = example[\"messages\"]\n",
159
+ " # Add an empty system message if there is none\n",
160
+ " if messages[0][\"role\"] != \"system\":\n",
161
+ " messages.insert(0, {\"role\": \"system\", \"content\": \"\"})\n",
162
+ " example[\"text\"] = tokenizer.apply_chat_template(\n",
163
+ " messages, tokenize=False, add_generation_prompt=False)\n",
164
+ " return example\n",
165
+ "\n",
166
+ "raw_dataset = load_dataset(\"HuggingFaceH4/ultrachat_200k\")\n",
167
+ "train_dataset = raw_dataset[\"train_sft\"]\n",
168
+ "test_dataset = raw_dataset[\"test_sft\"]\n",
169
+ "column_names = list(train_dataset.features)\n",
170
+ "\n",
171
+ "processed_train_dataset = train_dataset.map(\n",
172
+ " apply_chat_template,\n",
173
+ " fn_kwargs={\"tokenizer\": tokenizer},\n",
174
+ " num_proc=10,\n",
175
+ " remove_columns=column_names,\n",
176
+ " desc=\"Applying chat template to train_sft\",\n",
177
+ ")\n",
178
+ "\n",
179
+ "processed_test_dataset = test_dataset.map(\n",
180
+ " apply_chat_template,\n",
181
+ " fn_kwargs={\"tokenizer\": tokenizer},\n",
182
+ " num_proc=10,\n",
183
+ " remove_columns=column_names,\n",
184
+ " desc=\"Applying chat template to test_sft\",\n",
185
+ ")"
186
+ ]
187
+ },
188
+ {
189
+ "cell_type": "code",
190
+ "execution_count": 7,
191
+ "metadata": {},
192
+ "outputs": [
193
+ {
194
+ "name": "stderr",
195
+ "output_type": "stream",
196
+ "text": [
197
+ "Generating train split: 875 examples [00:02, 313.15 examples/s]\n"
198
+ ]
199
+ },
200
+ {
201
+ "ename": "KeyboardInterrupt",
202
+ "evalue": "",
203
+ "output_type": "error",
204
+ "traceback": [
205
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
206
+ "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
207
+ "Cell \u001b[1;32mIn[7], line 4\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m###########\u001b[39;00m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;66;03m# Training\u001b[39;00m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m###########\u001b[39;00m\n\u001b[1;32m----> 4\u001b[0m trainer \u001b[38;5;241m=\u001b[39m \u001b[43mSFTTrainer\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 5\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 6\u001b[0m \u001b[43m \u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtrain_conf\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 7\u001b[0m \u001b[43m \u001b[49m\u001b[43mpeft_config\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpeft_conf\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 8\u001b[0m \u001b[43m \u001b[49m\u001b[43mtrain_dataset\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mprocessed_train_dataset\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 9\u001b[0m \u001b[43m \u001b[49m\u001b[43meval_dataset\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mprocessed_test_dataset\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 10\u001b[0m \u001b[43m \u001b[49m\u001b[43mmax_seq_length\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m2048\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[0;32m 11\u001b[0m \u001b[43m \u001b[49m\u001b[43mdataset_text_field\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtext\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[0;32m 12\u001b[0m \u001b[43m \u001b[49m\u001b[43mtokenizer\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtokenizer\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 13\u001b[0m \u001b[43m \u001b[49m\u001b[43mpacking\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\n\u001b[0;32m 14\u001b[0m \u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m train_result \u001b[38;5;241m=\u001b[39m trainer\u001b[38;5;241m.\u001b[39mtrain()\n\u001b[0;32m 16\u001b[0m metrics \u001b[38;5;241m=\u001b[39m train_result\u001b[38;5;241m.\u001b[39mmetrics\n",
208
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\trl\\trainer\\sft_trainer.py:283\u001b[0m, in \u001b[0;36mSFTTrainer.__init__\u001b[1;34m(self, model, args, data_collator, train_dataset, eval_dataset, tokenizer, model_init, compute_metrics, callbacks, optimizers, preprocess_logits_for_metrics, peft_config, dataset_text_field, packing, formatting_func, max_seq_length, infinite, num_of_sequences, chars_per_token, dataset_num_proc, dataset_batch_size, neftune_noise_alpha, model_init_kwargs, dataset_kwargs, eval_packing)\u001b[0m\n\u001b[0;32m 281\u001b[0m dataset_kwargs \u001b[38;5;241m=\u001b[39m {}\n\u001b[0;32m 282\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m train_dataset \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m--> 283\u001b[0m train_dataset \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_prepare_dataset(\n\u001b[0;32m 284\u001b[0m train_dataset,\n\u001b[0;32m 285\u001b[0m tokenizer,\n\u001b[0;32m 286\u001b[0m packing,\n\u001b[0;32m 287\u001b[0m dataset_text_field,\n\u001b[0;32m 288\u001b[0m max_seq_length,\n\u001b[0;32m 289\u001b[0m formatting_func,\n\u001b[0;32m 290\u001b[0m num_of_sequences,\n\u001b[0;32m 291\u001b[0m chars_per_token,\n\u001b[0;32m 292\u001b[0m remove_unused_columns\u001b[38;5;241m=\u001b[39margs\u001b[38;5;241m.\u001b[39mremove_unused_columns \u001b[38;5;28;01mif\u001b[39;00m args \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[0;32m 293\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mdataset_kwargs,\n\u001b[0;32m 294\u001b[0m )\n\u001b[0;32m 295\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m eval_dataset \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 296\u001b[0m _multiple \u001b[38;5;241m=\u001b[39m \u001b[38;5;28misinstance\u001b[39m(eval_dataset, \u001b[38;5;28mdict\u001b[39m)\n",
209
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\trl\\trainer\\sft_trainer.py:435\u001b[0m, in \u001b[0;36mSFTTrainer._prepare_dataset\u001b[1;34m(self, dataset, tokenizer, packing, dataset_text_field, max_seq_length, formatting_func, num_of_sequences, chars_per_token, remove_unused_columns, append_concat_token, add_special_tokens, skip_prepare_dataset)\u001b[0m\n\u001b[0;32m 424\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_prepare_non_packed_dataloader(\n\u001b[0;32m 425\u001b[0m tokenizer,\n\u001b[0;32m 426\u001b[0m dataset,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 431\u001b[0m remove_unused_columns,\n\u001b[0;32m 432\u001b[0m )\n\u001b[0;32m 434\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 435\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_prepare_packed_dataloader\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 436\u001b[0m \u001b[43m \u001b[49m\u001b[43mtokenizer\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 437\u001b[0m \u001b[43m \u001b[49m\u001b[43mdataset\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 438\u001b[0m \u001b[43m \u001b[49m\u001b[43mdataset_text_field\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 439\u001b[0m \u001b[43m \u001b[49m\u001b[43mmax_seq_length\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 440\u001b[0m \u001b[43m \u001b[49m\u001b[43mnum_of_sequences\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 441\u001b[0m \u001b[43m \u001b[49m\u001b[43mchars_per_token\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 442\u001b[0m \u001b[43m \u001b[49m\u001b[43mformatting_func\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 443\u001b[0m \u001b[43m \u001b[49m\u001b[43mappend_concat_token\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 444\u001b[0m \u001b[43m \u001b[49m\u001b[43madd_special_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 445\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
210
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\trl\\trainer\\sft_trainer.py:539\u001b[0m, in \u001b[0;36mSFTTrainer._prepare_packed_dataloader\u001b[1;34m(self, tokenizer, dataset, dataset_text_field, max_seq_length, num_of_sequences, chars_per_token, formatting_func, append_concat_token, add_special_tokens)\u001b[0m\n\u001b[0;32m 536\u001b[0m \u001b[38;5;28;01myield from\u001b[39;00m constant_length_iterator\n\u001b[0;32m 538\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 539\u001b[0m packed_dataset \u001b[38;5;241m=\u001b[39m \u001b[43mDataset\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_generator\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 540\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_generator\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mgen_kwargs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m{\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mconstant_length_iterator\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mconstant_length_iterator\u001b[49m\u001b[43m}\u001b[49m\n\u001b[0;32m 541\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 542\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (DatasetGenerationError, SchemaInferenceError) \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[0;32m 543\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[0;32m 544\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mError occurred while packing the dataset. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 545\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMake sure that your dataset has enough samples to at least yield one packed sequence.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 546\u001b[0m ) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n",
211
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\datasets\\arrow_dataset.py:1125\u001b[0m, in \u001b[0;36mDataset.from_generator\u001b[1;34m(generator, features, cache_dir, keep_in_memory, gen_kwargs, num_proc, **kwargs)\u001b[0m\n\u001b[0;32m 1068\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Create a Dataset from a generator.\u001b[39;00m\n\u001b[0;32m 1069\u001b[0m \n\u001b[0;32m 1070\u001b[0m \u001b[38;5;124;03mArgs:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1113\u001b[0m \u001b[38;5;124;03m```\u001b[39;00m\n\u001b[0;32m 1114\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 1115\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mgenerator\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m GeneratorDatasetInputStream\n\u001b[0;32m 1117\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mGeneratorDatasetInputStream\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 1118\u001b[0m \u001b[43m \u001b[49m\u001b[43mgenerator\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mgenerator\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1119\u001b[0m \u001b[43m \u001b[49m\u001b[43mfeatures\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfeatures\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1120\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1121\u001b[0m \u001b[43m \u001b[49m\u001b[43mkeep_in_memory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkeep_in_memory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1122\u001b[0m \u001b[43m \u001b[49m\u001b[43mgen_kwargs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mgen_kwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1123\u001b[0m \u001b[43m \u001b[49m\u001b[43mnum_proc\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnum_proc\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1124\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m-> 1125\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
212
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\datasets\\io\\generator.py:47\u001b[0m, in \u001b[0;36mGeneratorDatasetInputStream.read\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 44\u001b[0m verification_mode \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m 45\u001b[0m base_path \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m---> 47\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbuilder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdownload_and_prepare\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 48\u001b[0m \u001b[43m \u001b[49m\u001b[43mdownload_config\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdownload_config\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 49\u001b[0m \u001b[43m \u001b[49m\u001b[43mdownload_mode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdownload_mode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 50\u001b[0m \u001b[43m \u001b[49m\u001b[43mverification_mode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mverification_mode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 51\u001b[0m \u001b[43m \u001b[49m\u001b[43mbase_path\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbase_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 52\u001b[0m \u001b[43m \u001b[49m\u001b[43mnum_proc\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mnum_proc\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 53\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 54\u001b[0m dataset \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuilder\u001b[38;5;241m.\u001b[39mas_dataset(\n\u001b[0;32m 55\u001b[0m split\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtrain\u001b[39m\u001b[38;5;124m\"\u001b[39m, verification_mode\u001b[38;5;241m=\u001b[39mverification_mode, in_memory\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkeep_in_memory\n\u001b[0;32m 56\u001b[0m )\n\u001b[0;32m 57\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m dataset\n",
213
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\datasets\\builder.py:1027\u001b[0m, in \u001b[0;36mDatasetBuilder.download_and_prepare\u001b[1;34m(self, output_dir, download_config, download_mode, verification_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs)\u001b[0m\n\u001b[0;32m 1025\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m num_proc \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 1026\u001b[0m prepare_split_kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnum_proc\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m num_proc\n\u001b[1;32m-> 1027\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_download_and_prepare(\n\u001b[0;32m 1028\u001b[0m dl_manager\u001b[38;5;241m=\u001b[39mdl_manager,\n\u001b[0;32m 1029\u001b[0m verification_mode\u001b[38;5;241m=\u001b[39mverification_mode,\n\u001b[0;32m 1030\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mprepare_split_kwargs,\n\u001b[0;32m 1031\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mdownload_and_prepare_kwargs,\n\u001b[0;32m 1032\u001b[0m )\n\u001b[0;32m 1033\u001b[0m \u001b[38;5;66;03m# Sync info\u001b[39;00m\n\u001b[0;32m 1034\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minfo\u001b[38;5;241m.\u001b[39mdataset_size \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msum\u001b[39m(split\u001b[38;5;241m.\u001b[39mnum_bytes \u001b[38;5;28;01mfor\u001b[39;00m split \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minfo\u001b[38;5;241m.\u001b[39msplits\u001b[38;5;241m.\u001b[39mvalues())\n",
214
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\datasets\\builder.py:1789\u001b[0m, in \u001b[0;36mGeneratorBasedBuilder._download_and_prepare\u001b[1;34m(self, dl_manager, verification_mode, **prepare_splits_kwargs)\u001b[0m\n\u001b[0;32m 1788\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_download_and_prepare\u001b[39m(\u001b[38;5;28mself\u001b[39m, dl_manager, verification_mode, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mprepare_splits_kwargs):\n\u001b[1;32m-> 1789\u001b[0m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39m_download_and_prepare(\n\u001b[0;32m 1790\u001b[0m dl_manager,\n\u001b[0;32m 1791\u001b[0m verification_mode,\n\u001b[0;32m 1792\u001b[0m check_duplicate_keys\u001b[38;5;241m=\u001b[39mverification_mode \u001b[38;5;241m==\u001b[39m VerificationMode\u001b[38;5;241m.\u001b[39mBASIC_CHECKS\n\u001b[0;32m 1793\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m verification_mode \u001b[38;5;241m==\u001b[39m VerificationMode\u001b[38;5;241m.\u001b[39mALL_CHECKS,\n\u001b[0;32m 1794\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mprepare_splits_kwargs,\n\u001b[0;32m 1795\u001b[0m )\n",
215
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\datasets\\builder.py:1122\u001b[0m, in \u001b[0;36mDatasetBuilder._download_and_prepare\u001b[1;34m(self, dl_manager, verification_mode, **prepare_split_kwargs)\u001b[0m\n\u001b[0;32m 1118\u001b[0m split_dict\u001b[38;5;241m.\u001b[39madd(split_generator\u001b[38;5;241m.\u001b[39msplit_info)\n\u001b[0;32m 1120\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 1121\u001b[0m \u001b[38;5;66;03m# Prepare split will record examples associated to the split\u001b[39;00m\n\u001b[1;32m-> 1122\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_prepare_split(split_generator, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mprepare_split_kwargs)\n\u001b[0;32m 1123\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m 1124\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(\n\u001b[0;32m 1125\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCannot find data file. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 1126\u001b[0m \u001b[38;5;241m+\u001b[39m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmanual_download_instructions \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 1127\u001b[0m \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124mOriginal error:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 1128\u001b[0m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(e)\n\u001b[0;32m 1129\u001b[0m ) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n",
216
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\datasets\\builder.py:1627\u001b[0m, in \u001b[0;36mGeneratorBasedBuilder._prepare_split\u001b[1;34m(self, split_generator, check_duplicate_keys, file_format, num_proc, max_shard_size)\u001b[0m\n\u001b[0;32m 1625\u001b[0m job_id \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m 1626\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m pbar:\n\u001b[1;32m-> 1627\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m job_id, done, content \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_prepare_split_single(\n\u001b[0;32m 1628\u001b[0m gen_kwargs\u001b[38;5;241m=\u001b[39mgen_kwargs, job_id\u001b[38;5;241m=\u001b[39mjob_id, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m_prepare_split_args\n\u001b[0;32m 1629\u001b[0m ):\n\u001b[0;32m 1630\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m done:\n\u001b[0;32m 1631\u001b[0m result \u001b[38;5;241m=\u001b[39m content\n",
217
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\datasets\\builder.py:1748\u001b[0m, in \u001b[0;36mGeneratorBasedBuilder._prepare_split_single\u001b[1;34m(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)\u001b[0m\n\u001b[0;32m 1746\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 1747\u001b[0m _time \u001b[38;5;241m=\u001b[39m time\u001b[38;5;241m.\u001b[39mtime()\n\u001b[1;32m-> 1748\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, record \u001b[38;5;129;01min\u001b[39;00m generator:\n\u001b[0;32m 1749\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m max_shard_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m writer\u001b[38;5;241m.\u001b[39m_num_bytes \u001b[38;5;241m>\u001b[39m max_shard_size:\n\u001b[0;32m 1750\u001b[0m num_examples, num_bytes \u001b[38;5;241m=\u001b[39m writer\u001b[38;5;241m.\u001b[39mfinalize()\n",
218
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\datasets\\packaged_modules\\generator\\generator.py:30\u001b[0m, in \u001b[0;36mGenerator._generate_examples\u001b[1;34m(self, **gen_kwargs)\u001b[0m\n\u001b[0;32m 29\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_generate_examples\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mgen_kwargs):\n\u001b[1;32m---> 30\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m idx, ex \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39mgenerator(\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mgen_kwargs)):\n\u001b[0;32m 31\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m idx, ex\n",
219
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\trl\\trainer\\sft_trainer.py:536\u001b[0m, in \u001b[0;36mSFTTrainer._prepare_packed_dataloader.<locals>.data_generator\u001b[1;34m(constant_length_iterator)\u001b[0m\n\u001b[0;32m 535\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdata_generator\u001b[39m(constant_length_iterator):\n\u001b[1;32m--> 536\u001b[0m \u001b[38;5;28;01myield from\u001b[39;00m constant_length_iterator\n",
220
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\trl\\trainer\\utils.py:466\u001b[0m, in \u001b[0;36mConstantLengthDataset.__iter__\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 464\u001b[0m more_examples \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m 465\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[1;32m--> 466\u001b[0m tokenized_inputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtokenizer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43madd_special_tokens\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43madd_special_tokens\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtruncation\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m[\n\u001b[0;32m 467\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124minput_ids\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 468\u001b[0m ]\n\u001b[0;32m 469\u001b[0m all_token_ids \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m 470\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m tokenized_input \u001b[38;5;129;01min\u001b[39;00m tokenized_inputs:\n",
221
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\transformers\\tokenization_utils_base.py:2883\u001b[0m, in \u001b[0;36mPreTrainedTokenizerBase.__call__\u001b[1;34m(self, text, text_pair, text_target, text_pair_target, add_special_tokens, padding, truncation, max_length, stride, is_split_into_words, pad_to_multiple_of, return_tensors, return_token_type_ids, return_attention_mask, return_overflowing_tokens, return_special_tokens_mask, return_offsets_mapping, return_length, verbose, **kwargs)\u001b[0m\n\u001b[0;32m 2881\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_in_target_context_manager:\n\u001b[0;32m 2882\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_switch_to_input_mode()\n\u001b[1;32m-> 2883\u001b[0m encodings \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_call_one(text\u001b[38;5;241m=\u001b[39mtext, text_pair\u001b[38;5;241m=\u001b[39mtext_pair, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mall_kwargs)\n\u001b[0;32m 2884\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m text_target \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 2885\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_switch_to_target_mode()\n",
222
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\transformers\\tokenization_utils_base.py:2969\u001b[0m, in \u001b[0;36mPreTrainedTokenizerBase._call_one\u001b[1;34m(self, text, text_pair, add_special_tokens, padding, truncation, max_length, stride, is_split_into_words, pad_to_multiple_of, return_tensors, return_token_type_ids, return_attention_mask, return_overflowing_tokens, return_special_tokens_mask, return_offsets_mapping, return_length, verbose, **kwargs)\u001b[0m\n\u001b[0;32m 2964\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[0;32m 2965\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbatch length of `text`: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlen\u001b[39m(text)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m does not match batch length of `text_pair`:\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 2966\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlen\u001b[39m(text_pair)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 2967\u001b[0m )\n\u001b[0;32m 2968\u001b[0m batch_text_or_text_pairs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(\u001b[38;5;28mzip\u001b[39m(text, text_pair)) \u001b[38;5;28;01mif\u001b[39;00m text_pair \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m text\n\u001b[1;32m-> 2969\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbatch_encode_plus(\n\u001b[0;32m 2970\u001b[0m batch_text_or_text_pairs\u001b[38;5;241m=\u001b[39mbatch_text_or_text_pairs,\n\u001b[0;32m 2971\u001b[0m add_special_tokens\u001b[38;5;241m=\u001b[39madd_special_tokens,\n\u001b[0;32m 2972\u001b[0m padding\u001b[38;5;241m=\u001b[39mpadding,\n\u001b[0;32m 2973\u001b[0m truncation\u001b[38;5;241m=\u001b[39mtruncation,\n\u001b[0;32m 2974\u001b[0m max_length\u001b[38;5;241m=\u001b[39mmax_length,\n\u001b[0;32m 2975\u001b[0m stride\u001b[38;5;241m=\u001b[39mstride,\n\u001b[0;32m 2976\u001b[0m is_split_into_words\u001b[38;5;241m=\u001b[39mis_split_into_words,\n\u001b[0;32m 2977\u001b[0m pad_to_multiple_of\u001b[38;5;241m=\u001b[39mpad_to_multiple_of,\n\u001b[0;32m 2978\u001b[0m return_tensors\u001b[38;5;241m=\u001b[39mreturn_tensors,\n\u001b[0;32m 2979\u001b[0m return_token_type_ids\u001b[38;5;241m=\u001b[39mreturn_token_type_ids,\n\u001b[0;32m 2980\u001b[0m return_attention_mask\u001b[38;5;241m=\u001b[39mreturn_attention_mask,\n\u001b[0;32m 2981\u001b[0m return_overflowing_tokens\u001b[38;5;241m=\u001b[39mreturn_overflowing_tokens,\n\u001b[0;32m 2982\u001b[0m return_special_tokens_mask\u001b[38;5;241m=\u001b[39mreturn_special_tokens_mask,\n\u001b[0;32m 2983\u001b[0m return_offsets_mapping\u001b[38;5;241m=\u001b[39mreturn_offsets_mapping,\n\u001b[0;32m 2984\u001b[0m return_length\u001b[38;5;241m=\u001b[39mreturn_length,\n\u001b[0;32m 2985\u001b[0m verbose\u001b[38;5;241m=\u001b[39mverbose,\n\u001b[0;32m 2986\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[0;32m 2987\u001b[0m )\n\u001b[0;32m 2988\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 2989\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mencode_plus(\n\u001b[0;32m 2990\u001b[0m text\u001b[38;5;241m=\u001b[39mtext,\n\u001b[0;32m 2991\u001b[0m text_pair\u001b[38;5;241m=\u001b[39mtext_pair,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 3007\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[0;32m 3008\u001b[0m )\n",
223
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\transformers\\tokenization_utils_base.py:3160\u001b[0m, in \u001b[0;36mPreTrainedTokenizerBase.batch_encode_plus\u001b[1;34m(self, batch_text_or_text_pairs, add_special_tokens, padding, truncation, max_length, stride, is_split_into_words, pad_to_multiple_of, return_tensors, return_token_type_ids, return_attention_mask, return_overflowing_tokens, return_special_tokens_mask, return_offsets_mapping, return_length, verbose, **kwargs)\u001b[0m\n\u001b[0;32m 3150\u001b[0m \u001b[38;5;66;03m# Backward compatibility for 'truncation_strategy', 'pad_to_max_length'\u001b[39;00m\n\u001b[0;32m 3151\u001b[0m padding_strategy, truncation_strategy, max_length, kwargs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_padding_truncation_strategies(\n\u001b[0;32m 3152\u001b[0m padding\u001b[38;5;241m=\u001b[39mpadding,\n\u001b[0;32m 3153\u001b[0m truncation\u001b[38;5;241m=\u001b[39mtruncation,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 3157\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[0;32m 3158\u001b[0m )\n\u001b[1;32m-> 3160\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_batch_encode_plus(\n\u001b[0;32m 3161\u001b[0m batch_text_or_text_pairs\u001b[38;5;241m=\u001b[39mbatch_text_or_text_pairs,\n\u001b[0;32m 3162\u001b[0m add_special_tokens\u001b[38;5;241m=\u001b[39madd_special_tokens,\n\u001b[0;32m 3163\u001b[0m padding_strategy\u001b[38;5;241m=\u001b[39mpadding_strategy,\n\u001b[0;32m 3164\u001b[0m truncation_strategy\u001b[38;5;241m=\u001b[39mtruncation_strategy,\n\u001b[0;32m 3165\u001b[0m max_length\u001b[38;5;241m=\u001b[39mmax_length,\n\u001b[0;32m 3166\u001b[0m stride\u001b[38;5;241m=\u001b[39mstride,\n\u001b[0;32m 3167\u001b[0m is_split_into_words\u001b[38;5;241m=\u001b[39mis_split_into_words,\n\u001b[0;32m 3168\u001b[0m pad_to_multiple_of\u001b[38;5;241m=\u001b[39mpad_to_multiple_of,\n\u001b[0;32m 3169\u001b[0m return_tensors\u001b[38;5;241m=\u001b[39mreturn_tensors,\n\u001b[0;32m 3170\u001b[0m return_token_type_ids\u001b[38;5;241m=\u001b[39mreturn_token_type_ids,\n\u001b[0;32m 3171\u001b[0m return_attention_mask\u001b[38;5;241m=\u001b[39mreturn_attention_mask,\n\u001b[0;32m 3172\u001b[0m return_overflowing_tokens\u001b[38;5;241m=\u001b[39mreturn_overflowing_tokens,\n\u001b[0;32m 3173\u001b[0m return_special_tokens_mask\u001b[38;5;241m=\u001b[39mreturn_special_tokens_mask,\n\u001b[0;32m 3174\u001b[0m return_offsets_mapping\u001b[38;5;241m=\u001b[39mreturn_offsets_mapping,\n\u001b[0;32m 3175\u001b[0m return_length\u001b[38;5;241m=\u001b[39mreturn_length,\n\u001b[0;32m 3176\u001b[0m verbose\u001b[38;5;241m=\u001b[39mverbose,\n\u001b[0;32m 3177\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[0;32m 3178\u001b[0m )\n",
224
+ "File \u001b[1;32me:\\Users\\frink\\Documents\\GitHub\\LLM Things\\Phi-3-training-Low-Ram\\venv\\lib\\site-packages\\transformers\\tokenization_utils_fast.py:511\u001b[0m, in \u001b[0;36mPreTrainedTokenizerFast._batch_encode_plus\u001b[1;34m(self, batch_text_or_text_pairs, add_special_tokens, padding_strategy, truncation_strategy, max_length, stride, is_split_into_words, pad_to_multiple_of, return_tensors, return_token_type_ids, return_attention_mask, return_overflowing_tokens, return_special_tokens_mask, return_offsets_mapping, return_length, verbose)\u001b[0m\n\u001b[0;32m 502\u001b[0m \u001b[38;5;66;03m# Set the truncation and padding strategy and restore the initial configuration\u001b[39;00m\n\u001b[0;32m 503\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset_truncation_and_padding(\n\u001b[0;32m 504\u001b[0m padding_strategy\u001b[38;5;241m=\u001b[39mpadding_strategy,\n\u001b[0;32m 505\u001b[0m truncation_strategy\u001b[38;5;241m=\u001b[39mtruncation_strategy,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 508\u001b[0m pad_to_multiple_of\u001b[38;5;241m=\u001b[39mpad_to_multiple_of,\n\u001b[0;32m 509\u001b[0m )\n\u001b[1;32m--> 511\u001b[0m encodings \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_tokenizer\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencode_batch\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 512\u001b[0m \u001b[43m \u001b[49m\u001b[43mbatch_text_or_text_pairs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 513\u001b[0m \u001b[43m \u001b[49m\u001b[43madd_special_tokens\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43madd_special_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 514\u001b[0m \u001b[43m \u001b[49m\u001b[43mis_pretokenized\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mis_split_into_words\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 515\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 517\u001b[0m \u001b[38;5;66;03m# Convert encoding to dict\u001b[39;00m\n\u001b[0;32m 518\u001b[0m \u001b[38;5;66;03m# `Tokens` has type: Tuple[\u001b[39;00m\n\u001b[0;32m 519\u001b[0m \u001b[38;5;66;03m# List[Dict[str, List[List[int]]]] or List[Dict[str, 2D-Tensor]],\u001b[39;00m\n\u001b[0;32m 520\u001b[0m \u001b[38;5;66;03m# List[EncodingFast]\u001b[39;00m\n\u001b[0;32m 521\u001b[0m \u001b[38;5;66;03m# ]\u001b[39;00m\n\u001b[0;32m 522\u001b[0m \u001b[38;5;66;03m# with nested dimensions corresponding to batch, overflows, sequence length\u001b[39;00m\n\u001b[0;32m 523\u001b[0m tokens_and_encodings \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m 524\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_convert_encoding(\n\u001b[0;32m 525\u001b[0m encoding\u001b[38;5;241m=\u001b[39mencoding,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 534\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m encoding \u001b[38;5;129;01min\u001b[39;00m encodings\n\u001b[0;32m 535\u001b[0m ]\n",
225
+ "\u001b[1;31mKeyboardInterrupt\u001b[0m: "
226
+ ]
227
+ }
228
+ ],
229
+ "source": [
230
+ "###########\n",
231
+ "# Training\n",
232
+ "###########\n",
233
+ "trainer = SFTTrainer(\n",
234
+ " model=model,\n",
235
+ " args=train_conf,\n",
236
+ " peft_config=peft_conf,\n",
237
+ " train_dataset=processed_train_dataset,\n",
238
+ " eval_dataset=processed_test_dataset,\n",
239
+ " max_seq_length=2048,\n",
240
+ " dataset_text_field=\"text\",\n",
241
+ " tokenizer=tokenizer,\n",
242
+ " packing=True\n",
243
+ ")\n",
244
+ "train_result = trainer.train()\n",
245
+ "metrics = train_result.metrics\n",
246
+ "trainer.log_metrics(\"train\", metrics)\n",
247
+ "trainer.save_metrics(\"train\", metrics)\n",
248
+ "trainer.save_state()"
249
+ ]
250
+ },
251
+ {
252
+ "cell_type": "code",
253
+ "execution_count": null,
254
+ "metadata": {},
255
+ "outputs": [],
256
+ "source": [
257
+ "#############\n",
258
+ "# Evaluation\n",
259
+ "#############\n",
260
+ "tokenizer.padding_side = 'left'\n",
261
+ "metrics = trainer.evaluate()\n",
262
+ "metrics[\"eval_samples\"] = len(processed_test_dataset)\n",
263
+ "trainer.log_metrics(\"eval\", metrics)\n",
264
+ "trainer.save_metrics(\"eval\", metrics)"
265
+ ]
266
+ },
267
+ {
268
+ "cell_type": "code",
269
+ "execution_count": null,
270
+ "metadata": {},
271
+ "outputs": [],
272
+ "source": [
273
+ "############\n",
274
+ "# Save model\n",
275
+ "############\n",
276
+ "trainer.save_model(train_conf.output_dir)"
277
+ ]
278
+ }
279
+ ],
280
+ "metadata": {
281
+ "kernelspec": {
282
+ "display_name": "venv",
283
+ "language": "python",
284
+ "name": "python3"
285
+ },
286
+ "language_info": {
287
+ "codemirror_mode": {
288
+ "name": "ipython",
289
+ "version": 3
290
+ },
291
+ "file_extension": ".py",
292
+ "mimetype": "text/x-python",
293
+ "name": "python",
294
+ "nbconvert_exporter": "python",
295
+ "pygments_lexer": "ipython3",
296
+ "version": "3.10.10"
297
+ }
298
+ },
299
+ "nbformat": 4,
300
+ "nbformat_minor": 2
301
+ }