joanllop commited on
Commit
f8df299
1 Parent(s): ed8c5c9

First model version

Browse files
README.md CHANGED
@@ -1,3 +1,744 @@
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ tags:
3
+ - generated_from_trainer
4
+ datasets:
5
+ - /bscdata/data/open_data_26B_tokens_balanced_es_ca/open_data_26B_tokens_balanced_es_ca.py
6
+ metrics:
7
+ - accuracy
8
+ model-index:
9
+ - name: falcon_7b_balanced_tokenizer_fp16_CPT_open_data_26B_tokens_balanced_es_ca
10
+ results:
11
+ - task:
12
+ name: Causal Language Modeling
13
+ type: text-generation
14
+ dataset:
15
+ name: /bscdata/data/open_data_26B_tokens_balanced_es_ca/open_data_26B_tokens_balanced_es_ca.py
16
+ default
17
+ type: /bscdata/data/open_data_26B_tokens_balanced_es_ca/open_data_26B_tokens_balanced_es_ca.py
18
+ config: default
19
+ split: validation
20
+ args: default
21
+ metrics:
22
+ - name: Accuracy
23
+ type: accuracy
24
+ value: 0.5258444783433934
25
  ---
26
+
27
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
28
+ should probably proofread and complete it, then remove this comment. -->
29
+
30
+ # falcon_7b_balanced_tokenizer_fp16_CPT_open_data_26B_tokens_balanced_es_ca
31
+
32
+ This model is a fine-tuned version of [/bscdata/models/falcon_7b_balanced_tokenizer_fp16/](https://huggingface.co//bscdata/models/falcon_7b_balanced_tokenizer_fp16/) on the /bscdata/data/open_data_26B_tokens_balanced_es_ca/open_data_26B_tokens_balanced_es_ca.py default dataset.
33
+ It achieves the following results on the evaluation set:
34
+ - Loss: 2.1504
35
+ - Accuracy: 0.5258
36
+
37
+ ## Model description
38
+
39
+ More information needed
40
+
41
+ ## Intended uses & limitations
42
+
43
+ More information needed
44
+
45
+ ## Training and evaluation data
46
+
47
+ More information needed
48
+
49
+ ## Training procedure
50
+
51
+ ### Training hyperparameters
52
+
53
+ The following hyperparameters were used during training:
54
+ - learning_rate: 5e-05
55
+ - train_batch_size: 1
56
+ - eval_batch_size: 1
57
+ - seed: 42
58
+ - distributed_type: multi-GPU
59
+ - num_devices: 8
60
+ - total_train_batch_size: 8
61
+ - total_eval_batch_size: 8
62
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
63
+ - lr_scheduler_type: linear
64
+ - num_epochs: 1.0
65
+
66
+ ### Training results
67
+
68
+ | Training Loss | Epoch | Step | Accuracy | Validation Loss |
69
+ |:-------------:|:-----:|:-------:|:--------:|:---------------:|
70
+ | 5.3279 | 0.0 | 5000 | 0.3133 | 3.9941 |
71
+ | 3.5754 | 0.0 | 10000 | 0.3824 | 3.3105 |
72
+ | 3.6102 | 0.0 | 15000 | 0.3977 | 3.1660 |
73
+ | 3.0639 | 0.01 | 20000 | 0.4134 | 3.0215 |
74
+ | 2.9477 | 0.01 | 25000 | 0.4252 | 2.9199 |
75
+ | 2.8589 | 0.01 | 30000 | 0.4315 | 2.8672 |
76
+ | 2.8063 | 0.01 | 35000 | 0.4388 | 2.8027 |
77
+ | 2.7646 | 0.01 | 40000 | 0.4419 | 2.7715 |
78
+ | 2.7306 | 0.01 | 45000 | 0.4467 | 2.7363 |
79
+ | 2.7106 | 0.01 | 50000 | 0.4493 | 2.7129 |
80
+ | 2.6829 | 0.02 | 55000 | 0.4522 | 2.6895 |
81
+ | 2.6703 | 0.02 | 60000 | 0.4537 | 2.6758 |
82
+ | 2.6522 | 0.02 | 65000 | 0.4560 | 2.6602 |
83
+ | 2.6377 | 0.02 | 70000 | 0.4574 | 2.6484 |
84
+ | 2.6241 | 0.02 | 75000 | 0.4587 | 2.6348 |
85
+ | 2.6159 | 0.02 | 80000 | 0.4604 | 2.625 |
86
+ | 2.5959 | 0.03 | 85000 | 0.4613 | 2.6133 |
87
+ | 2.5877 | 0.03 | 90000 | 0.4624 | 2.6035 |
88
+ | 2.5832 | 0.03 | 95000 | 0.4632 | 2.5996 |
89
+ | 2.5726 | 0.03 | 100000 | 0.4648 | 2.5859 |
90
+ | 2.5723 | 0.03 | 105000 | 0.4655 | 2.5801 |
91
+ | 2.5584 | 0.03 | 110000 | 0.4641 | 2.5938 |
92
+ | 2.5541 | 0.03 | 115000 | 0.4673 | 2.5664 |
93
+ | 2.541 | 0.04 | 120000 | 0.4684 | 2.5586 |
94
+ | 2.5359 | 0.04 | 125000 | 0.4674 | 2.5645 |
95
+ | 2.5298 | 0.04 | 130000 | 0.4699 | 2.5449 |
96
+ | 2.5258 | 0.04 | 135000 | 0.4703 | 2.5410 |
97
+ | 2.5207 | 0.04 | 140000 | 0.4709 | 2.5371 |
98
+ | 2.5167 | 0.04 | 145000 | 0.4719 | 2.5312 |
99
+ | 2.5101 | 0.04 | 150000 | 0.4702 | 2.5449 |
100
+ | 2.5058 | 0.05 | 155000 | 0.4730 | 2.5215 |
101
+ | 2.5021 | 0.05 | 160000 | 0.4734 | 2.5195 |
102
+ | 2.8135 | 0.05 | 165000 | 0.4317 | 2.8320 |
103
+ | 2.7932 | 0.05 | 170000 | 0.4730 | 2.5215 |
104
+ | 2.4914 | 0.05 | 175000 | 0.4752 | 2.5059 |
105
+ | 2.487 | 0.05 | 180000 | 0.4754 | 2.5039 |
106
+ | 2.4829 | 0.06 | 185000 | 0.4751 | 2.5039 |
107
+ | 2.4778 | 0.06 | 190000 | 0.4763 | 2.4961 |
108
+ | 2.4779 | 0.06 | 195000 | 0.4770 | 2.4922 |
109
+ | 2.4685 | 0.06 | 200000 | 0.4766 | 2.4941 |
110
+ | 2.4661 | 0.06 | 205000 | 0.4776 | 2.4844 |
111
+ | 2.4579 | 0.06 | 210000 | 0.4783 | 2.4805 |
112
+ | 2.4589 | 0.06 | 215000 | 0.4788 | 2.4785 |
113
+ | 2.4571 | 0.07 | 220000 | 0.4793 | 2.4746 |
114
+ | 2.4504 | 0.07 | 225000 | 0.4797 | 2.4727 |
115
+ | 2.4538 | 0.07 | 230000 | 0.4800 | 2.4688 |
116
+ | 2.4481 | 0.07 | 235000 | 0.4806 | 2.4668 |
117
+ | 2.4454 | 0.07 | 240000 | 0.4810 | 2.4609 |
118
+ | 2.44 | 0.07 | 245000 | 0.4811 | 2.4590 |
119
+ | 2.4392 | 0.07 | 250000 | 0.4811 | 2.4590 |
120
+ | 2.431 | 0.08 | 255000 | 0.4813 | 2.4570 |
121
+ | 2.4377 | 0.08 | 260000 | 0.4823 | 2.4512 |
122
+ | 2.4299 | 0.08 | 265000 | 0.4826 | 2.4473 |
123
+ | 2.4283 | 0.08 | 270000 | 0.4828 | 2.4473 |
124
+ | 2.4256 | 0.08 | 275000 | 0.4833 | 2.4434 |
125
+ | 2.4198 | 0.08 | 280000 | 0.4838 | 2.4414 |
126
+ | 2.4174 | 0.09 | 285000 | 0.4840 | 2.4414 |
127
+ | 2.4151 | 0.09 | 290000 | 0.4844 | 2.4355 |
128
+ | 2.4191 | 0.09 | 295000 | 0.4847 | 2.4336 |
129
+ | 2.4071 | 0.09 | 300000 | 0.4848 | 2.4316 |
130
+ | 2.4126 | 0.09 | 305000 | 0.4855 | 2.4277 |
131
+ | 2.4053 | 0.09 | 310000 | 0.4851 | 2.4297 |
132
+ | 2.4071 | 0.09 | 315000 | 0.4858 | 2.4258 |
133
+ | 2.4027 | 0.1 | 320000 | 0.4866 | 2.4219 |
134
+ | 2.4013 | 0.1 | 325000 | 0.4867 | 2.4180 |
135
+ | 2.4032 | 0.1 | 330000 | 0.4866 | 2.4180 |
136
+ | 2.3919 | 0.1 | 335000 | 0.4871 | 2.4160 |
137
+ | 2.3936 | 0.1 | 340000 | 0.4873 | 2.4141 |
138
+ | 2.3905 | 0.1 | 345000 | 0.4878 | 2.4102 |
139
+ | 2.3889 | 0.1 | 350000 | 0.4881 | 2.4102 |
140
+ | 2.3866 | 0.11 | 355000 | 0.4884 | 2.4082 |
141
+ | 2.3823 | 0.11 | 360000 | 0.4888 | 2.4062 |
142
+ | 2.3828 | 0.11 | 365000 | 0.4888 | 2.4023 |
143
+ | 2.3795 | 0.11 | 370000 | 0.4889 | 2.4004 |
144
+ | 2.3812 | 0.11 | 375000 | 0.4868 | 2.4160 |
145
+ | 2.3789 | 0.11 | 380000 | 0.4896 | 2.3965 |
146
+ | 2.372 | 0.12 | 385000 | 0.4895 | 2.3965 |
147
+ | 2.3732 | 0.12 | 390000 | 0.4899 | 2.3965 |
148
+ | 2.3725 | 0.12 | 395000 | 0.4903 | 2.3926 |
149
+ | 2.3716 | 0.12 | 400000 | 0.4904 | 2.3906 |
150
+ | 2.3709 | 0.12 | 405000 | 0.4904 | 2.3906 |
151
+ | 2.3619 | 0.12 | 410000 | 0.4906 | 2.3887 |
152
+ | 2.367 | 0.12 | 415000 | 0.4912 | 2.3867 |
153
+ | 2.3639 | 0.13 | 420000 | 0.4912 | 2.3848 |
154
+ | 2.3621 | 0.13 | 425000 | 0.4919 | 2.3828 |
155
+ | 2.3578 | 0.13 | 430000 | 0.4920 | 2.3809 |
156
+ | 2.3608 | 0.13 | 435000 | 0.4922 | 2.3789 |
157
+ | 2.3541 | 0.13 | 440000 | 0.4923 | 2.3770 |
158
+ | 2.3556 | 0.13 | 445000 | 0.4926 | 2.3770 |
159
+ | 2.3562 | 0.13 | 450000 | 0.4928 | 2.3770 |
160
+ | 2.3641 | 0.14 | 455000 | 0.4910 | 2.3867 |
161
+ | 2.3641 | 0.14 | 460000 | 0.4911 | 2.3867 |
162
+ | 2.3646 | 0.14 | 465000 | 0.4911 | 2.3867 |
163
+ | 2.3629 | 0.14 | 470000 | 0.4911 | 2.3848 |
164
+ | 2.3659 | 0.14 | 475000 | 0.4914 | 2.3828 |
165
+ | 2.3651 | 0.14 | 480000 | 0.4916 | 2.3828 |
166
+ | 2.3608 | 0.15 | 485000 | 0.4918 | 2.3809 |
167
+ | 2.3612 | 0.15 | 490000 | 0.4920 | 2.3809 |
168
+ | 2.3569 | 0.15 | 495000 | 0.4922 | 2.3789 |
169
+ | 2.3557 | 0.15 | 500000 | 0.4923 | 2.3789 |
170
+ | 2.3541 | 0.15 | 505000 | 0.4922 | 2.3770 |
171
+ | 2.351 | 0.15 | 510000 | 0.4927 | 2.375 |
172
+ | 2.3504 | 0.15 | 515000 | 0.4926 | 2.375 |
173
+ | 2.3479 | 0.16 | 520000 | 0.4929 | 2.3730 |
174
+ | 2.3451 | 0.16 | 525000 | 0.4929 | 2.3711 |
175
+ | 2.3505 | 0.16 | 530000 | 0.4934 | 2.3691 |
176
+ | 2.3457 | 0.16 | 535000 | 0.4934 | 2.3691 |
177
+ | 2.3479 | 0.16 | 540000 | 0.4937 | 2.3691 |
178
+ | 2.3421 | 0.16 | 545000 | 0.4936 | 2.3672 |
179
+ | 2.3433 | 0.16 | 550000 | 0.4937 | 2.3672 |
180
+ | 2.3425 | 0.17 | 555000 | 0.4939 | 2.3652 |
181
+ | 2.3403 | 0.17 | 560000 | 0.4942 | 2.3633 |
182
+ | 2.3417 | 0.17 | 565000 | 0.4944 | 2.3613 |
183
+ | 2.3382 | 0.17 | 570000 | 0.4947 | 2.3613 |
184
+ | 2.3354 | 0.17 | 575000 | 0.4949 | 2.3594 |
185
+ | 2.3366 | 0.17 | 580000 | 0.4947 | 2.3594 |
186
+ | 2.3373 | 0.18 | 585000 | 0.4945 | 2.3594 |
187
+ | 2.3365 | 0.18 | 590000 | 0.4949 | 2.3594 |
188
+ | 2.3318 | 0.18 | 595000 | 0.4953 | 2.3555 |
189
+ | 2.3278 | 0.18 | 600000 | 0.4958 | 2.3535 |
190
+ | 2.3277 | 0.18 | 605000 | 0.4959 | 2.3516 |
191
+ | 2.326 | 0.18 | 610000 | 0.4961 | 2.3516 |
192
+ | 2.3273 | 0.18 | 615000 | 0.4961 | 2.3516 |
193
+ | 2.3284 | 0.19 | 620000 | 0.4965 | 2.3496 |
194
+ | 2.3276 | 0.19 | 625000 | 0.4966 | 2.3477 |
195
+ | 2.3228 | 0.19 | 630000 | 0.4967 | 2.3457 |
196
+ | 2.3219 | 0.19 | 635000 | 0.4968 | 2.3457 |
197
+ | 2.326 | 0.19 | 640000 | 0.4970 | 2.3438 |
198
+ | 2.3191 | 0.19 | 645000 | 0.4972 | 2.3418 |
199
+ | 2.3167 | 0.19 | 650000 | 0.4973 | 2.3438 |
200
+ | 2.3172 | 0.2 | 655000 | 0.4974 | 2.3418 |
201
+ | 2.3194 | 0.2 | 660000 | 0.4977 | 2.3379 |
202
+ | 2.3204 | 0.2 | 665000 | 0.4976 | 2.3398 |
203
+ | 2.309 | 0.2 | 670000 | 0.4980 | 2.3359 |
204
+ | 2.3147 | 0.2 | 675000 | 0.4981 | 2.3379 |
205
+ | 2.3122 | 0.2 | 680000 | 0.4980 | 2.3359 |
206
+ | 2.3096 | 0.21 | 685000 | 0.4984 | 2.3340 |
207
+ | 2.3093 | 0.21 | 690000 | 0.4986 | 2.3340 |
208
+ | 2.3048 | 0.21 | 695000 | 0.4985 | 2.3320 |
209
+ | 2.3111 | 0.21 | 700000 | 0.4988 | 2.3301 |
210
+ | 2.3074 | 0.21 | 705000 | 0.4989 | 2.3301 |
211
+ | 2.3082 | 0.21 | 710000 | 0.4992 | 2.3301 |
212
+ | 2.3093 | 0.21 | 715000 | 0.4994 | 2.3281 |
213
+ | 2.3011 | 0.22 | 720000 | 0.4995 | 2.3281 |
214
+ | 2.2998 | 0.22 | 725000 | 0.4995 | 2.3262 |
215
+ | 2.3012 | 0.22 | 730000 | 0.4996 | 2.3262 |
216
+ | 2.3002 | 0.22 | 735000 | 0.4997 | 2.3242 |
217
+ | 2.2994 | 0.22 | 740000 | 0.5000 | 2.3242 |
218
+ | 2.299 | 0.22 | 745000 | 0.5001 | 2.3223 |
219
+ | 2.2969 | 0.22 | 750000 | 0.5003 | 2.3223 |
220
+ | 2.2934 | 0.23 | 755000 | 0.5004 | 2.3203 |
221
+ | 2.2988 | 0.23 | 760000 | 0.5005 | 2.3184 |
222
+ | 2.2911 | 0.23 | 765000 | 0.5007 | 2.3184 |
223
+ | 2.2929 | 0.23 | 770000 | 0.5008 | 2.3184 |
224
+ | 2.2926 | 0.23 | 775000 | 0.5009 | 2.3164 |
225
+ | 2.292 | 0.23 | 780000 | 0.5012 | 2.3164 |
226
+ | 2.2932 | 0.24 | 785000 | 0.5014 | 2.3145 |
227
+ | 2.2903 | 0.24 | 790000 | 0.5014 | 2.3145 |
228
+ | 2.2886 | 0.24 | 795000 | 0.5015 | 2.3125 |
229
+ | 2.2924 | 0.24 | 800000 | 0.5015 | 2.3125 |
230
+ | 2.2891 | 0.24 | 805000 | 0.5019 | 2.3105 |
231
+ | 2.2862 | 0.24 | 810000 | 0.5020 | 2.3086 |
232
+ | 2.2858 | 0.24 | 815000 | 0.5022 | 2.3086 |
233
+ | 2.2841 | 0.25 | 820000 | 0.5023 | 2.3066 |
234
+ | 2.2843 | 0.25 | 825000 | 0.5022 | 2.3086 |
235
+ | 2.2832 | 0.25 | 830000 | 0.5025 | 2.3066 |
236
+ | 2.2846 | 0.25 | 835000 | 0.5026 | 2.3066 |
237
+ | 2.2784 | 0.25 | 840000 | 0.5027 | 2.3047 |
238
+ | 2.277 | 0.25 | 845000 | 0.5028 | 2.3027 |
239
+ | 2.276 | 0.25 | 850000 | 0.5026 | 2.3066 |
240
+ | 2.2802 | 0.26 | 855000 | 0.5031 | 2.3027 |
241
+ | 2.2781 | 0.26 | 860000 | 0.5032 | 2.3008 |
242
+ | 2.2749 | 0.26 | 865000 | 0.5038 | 2.2988 |
243
+ | 2.2729 | 0.26 | 870000 | 0.5037 | 2.2969 |
244
+ | 2.2708 | 0.26 | 875000 | 0.5039 | 2.2969 |
245
+ | 2.2754 | 0.26 | 880000 | 0.5039 | 2.2969 |
246
+ | 2.2761 | 0.27 | 885000 | 0.5041 | 2.2949 |
247
+ | 2.2742 | 0.27 | 890000 | 0.5041 | 2.2949 |
248
+ | 2.2734 | 0.27 | 895000 | 0.5041 | 2.2949 |
249
+ | 2.2682 | 0.27 | 900000 | 0.5044 | 2.2930 |
250
+ | 2.2667 | 0.27 | 905000 | 0.5045 | 2.2930 |
251
+ | 2.2676 | 0.27 | 910000 | 0.5046 | 2.2930 |
252
+ | 2.2707 | 0.27 | 915000 | 0.5047 | 2.2910 |
253
+ | 2.265 | 0.28 | 920000 | 0.5048 | 2.2910 |
254
+ | 2.2676 | 0.28 | 925000 | 0.5046 | 2.2910 |
255
+ | 2.2662 | 0.28 | 930000 | 0.5052 | 2.2891 |
256
+ | 2.2706 | 0.28 | 935000 | 0.5051 | 2.2891 |
257
+ | 2.2657 | 0.28 | 940000 | 0.5049 | 2.2891 |
258
+ | 2.2672 | 0.28 | 945000 | 0.5050 | 2.2871 |
259
+ | 2.2716 | 0.28 | 950000 | 0.5037 | 2.2969 |
260
+ | 2.2702 | 0.29 | 955000 | 0.5037 | 2.2988 |
261
+ | 2.2708 | 0.29 | 960000 | 0.5035 | 2.2988 |
262
+ | 2.2738 | 0.29 | 965000 | 0.5035 | 2.2988 |
263
+ | 2.2737 | 0.29 | 970000 | 0.5036 | 2.2988 |
264
+ | 2.2763 | 0.29 | 975000 | 0.4987 | 2.3301 |
265
+ | 2.2738 | 0.29 | 980000 | 0.5035 | 2.2969 |
266
+ | 2.2737 | 0.3 | 985000 | 0.5036 | 2.2969 |
267
+ | 2.2748 | 0.3 | 990000 | 0.5036 | 2.2969 |
268
+ | 2.2724 | 0.3 | 995000 | 0.5038 | 2.2969 |
269
+ | 2.2744 | 0.3 | 1000000 | 0.5033 | 2.2988 |
270
+ | 2.2694 | 0.3 | 1005000 | 0.5033 | 2.2988 |
271
+ | 2.2684 | 0.3 | 1010000 | 0.5039 | 2.2949 |
272
+ | 2.2731 | 0.3 | 1015000 | 0.5040 | 2.2949 |
273
+ | 2.2714 | 0.31 | 1020000 | 0.5042 | 2.2949 |
274
+ | 2.2687 | 0.31 | 1025000 | 0.5045 | 2.2930 |
275
+ | 2.2673 | 0.31 | 1030000 | 0.5046 | 2.2930 |
276
+ | 2.2677 | 0.31 | 1035000 | 0.5044 | 2.2930 |
277
+ | 2.265 | 0.31 | 1040000 | 0.5047 | 2.2910 |
278
+ | 2.2659 | 0.31 | 1045000 | 0.5045 | 2.2910 |
279
+ | 2.2633 | 0.31 | 1050000 | 0.5042 | 2.2949 |
280
+ | 2.2689 | 0.32 | 1055000 | 0.5050 | 2.2891 |
281
+ | 2.2617 | 0.32 | 1060000 | 0.5049 | 2.2891 |
282
+ | 2.2613 | 0.32 | 1065000 | 0.5052 | 2.2871 |
283
+ | 2.2649 | 0.32 | 1070000 | 0.5047 | 2.2891 |
284
+ | 2.2587 | 0.32 | 1075000 | 0.5053 | 2.2871 |
285
+ | 2.2641 | 0.32 | 1080000 | 0.5054 | 2.2852 |
286
+ | 2.2634 | 0.33 | 1085000 | 0.5057 | 2.2852 |
287
+ | 2.2597 | 0.33 | 1090000 | 0.5057 | 2.2832 |
288
+ | 2.2572 | 0.33 | 1095000 | 0.5060 | 2.2832 |
289
+ | 2.2566 | 0.33 | 1100000 | 0.5056 | 2.2832 |
290
+ | 2.2576 | 0.33 | 1105000 | 0.5056 | 2.2832 |
291
+ | 2.2612 | 0.33 | 1110000 | 0.5057 | 2.2832 |
292
+ | 2.2585 | 0.33 | 1115000 | 0.5059 | 2.2812 |
293
+ | 2.2528 | 0.34 | 1120000 | 0.5060 | 2.2812 |
294
+ | 2.2599 | 0.34 | 1125000 | 0.5060 | 2.2812 |
295
+ | 2.2556 | 0.34 | 1130000 | 0.5066 | 2.2773 |
296
+ | 2.2519 | 0.34 | 1135000 | 0.5064 | 2.2793 |
297
+ | 2.2567 | 0.34 | 1140000 | 0.5068 | 2.2773 |
298
+ | 2.2516 | 0.34 | 1145000 | 0.5069 | 2.2754 |
299
+ | 2.2533 | 0.34 | 1150000 | 0.5068 | 2.2754 |
300
+ | 2.2532 | 0.35 | 1155000 | 0.5070 | 2.2754 |
301
+ | 2.2572 | 0.35 | 1160000 | 0.5064 | 2.2793 |
302
+ | 2.2514 | 0.35 | 1165000 | 0.5072 | 2.2734 |
303
+ | 2.2471 | 0.35 | 1170000 | 0.5073 | 2.2734 |
304
+ | 2.2524 | 0.35 | 1175000 | 0.5076 | 2.2715 |
305
+ | 2.247 | 0.35 | 1180000 | 0.5073 | 2.2715 |
306
+ | 2.2491 | 0.35 | 1185000 | 0.5077 | 2.2715 |
307
+ | 2.2481 | 0.36 | 1190000 | 0.5078 | 2.2695 |
308
+ | 2.2465 | 0.36 | 1195000 | 0.5069 | 2.2734 |
309
+ | 2.2494 | 0.36 | 1200000 | 0.5067 | 2.2793 |
310
+ | 2.2541 | 0.36 | 1205000 | 0.5069 | 2.2754 |
311
+ | 2.25 | 0.36 | 1210000 | 0.5067 | 2.2754 |
312
+ | 2.25 | 0.36 | 1215000 | 0.5064 | 2.2793 |
313
+ | 2.2508 | 0.37 | 1220000 | 0.5070 | 2.2734 |
314
+ | 2.2496 | 0.37 | 1225000 | 0.5070 | 2.2734 |
315
+ | 2.2499 | 0.37 | 1230000 | 0.5073 | 2.2734 |
316
+ | 2.2467 | 0.37 | 1235000 | 0.5076 | 2.2715 |
317
+ | 2.2497 | 0.37 | 1240000 | 0.5073 | 2.2715 |
318
+ | 2.2463 | 0.37 | 1245000 | 0.5073 | 2.2715 |
319
+ | 2.2479 | 0.37 | 1250000 | 0.5078 | 2.2695 |
320
+ | 2.2445 | 0.38 | 1255000 | 0.5079 | 2.2695 |
321
+ | 2.247 | 0.38 | 1260000 | 0.5078 | 2.2695 |
322
+ | 2.2443 | 0.38 | 1265000 | 0.5079 | 2.2676 |
323
+ | 2.243 | 0.38 | 1270000 | 0.5081 | 2.2676 |
324
+ | 2.2454 | 0.38 | 1275000 | 0.5077 | 2.2715 |
325
+ | 2.2451 | 0.38 | 1280000 | 0.5081 | 2.2695 |
326
+ | 2.2455 | 0.38 | 1285000 | 0.5084 | 2.2656 |
327
+ | 2.241 | 0.39 | 1290000 | 0.5083 | 2.2676 |
328
+ | 2.243 | 0.39 | 1295000 | 0.5086 | 2.2637 |
329
+ | 2.2408 | 0.39 | 1300000 | 0.5084 | 2.2637 |
330
+ | 2.2508 | 0.39 | 1305000 | 0.5063 | 2.2793 |
331
+ | 2.252 | 0.39 | 1310000 | 0.5047 | 2.2910 |
332
+ | 2.7482 | 0.39 | 1315000 | 0.4506 | 2.6465 |
333
+ | 2.4189 | 0.4 | 1320000 | 0.5070 | 2.2754 |
334
+ | 2.2446 | 0.4 | 1325000 | 0.5081 | 2.2676 |
335
+ | 2.2416 | 0.4 | 1330000 | 0.5087 | 2.2637 |
336
+ | 2.2421 | 0.4 | 1335000 | 0.5088 | 2.2617 |
337
+ | 2.2367 | 0.4 | 1340000 | 0.5092 | 2.2617 |
338
+ | 2.2355 | 0.4 | 1345000 | 0.5091 | 2.2598 |
339
+ | 2.2379 | 0.4 | 1350000 | 0.5094 | 2.2598 |
340
+ | 2.2365 | 0.41 | 1355000 | 0.5094 | 2.2598 |
341
+ | 2.2379 | 0.41 | 1360000 | 0.5091 | 2.2578 |
342
+ | 2.235 | 0.41 | 1365000 | 0.5095 | 2.2578 |
343
+ | 2.236 | 0.41 | 1370000 | 0.5093 | 2.2578 |
344
+ | 2.2344 | 0.41 | 1375000 | 0.5095 | 2.2578 |
345
+ | 2.2348 | 0.41 | 1380000 | 0.5096 | 2.2559 |
346
+ | 2.2306 | 0.41 | 1385000 | 0.5097 | 2.2559 |
347
+ | 2.2293 | 0.42 | 1390000 | 0.5098 | 2.2559 |
348
+ | 2.2311 | 0.42 | 1395000 | 0.5101 | 2.2539 |
349
+ | 2.231 | 0.42 | 1400000 | 0.5101 | 2.2539 |
350
+ | 2.2272 | 0.42 | 1405000 | 0.5102 | 2.2520 |
351
+ | 2.2264 | 0.42 | 1410000 | 0.5102 | 2.2539 |
352
+ | 2.2295 | 0.42 | 1415000 | 0.5104 | 2.2520 |
353
+ | 2.2281 | 0.43 | 1420000 | 0.5104 | 2.2520 |
354
+ | 2.2234 | 0.43 | 1425000 | 0.5107 | 2.25 |
355
+ | 2.2293 | 0.43 | 1430000 | 0.5107 | 2.25 |
356
+ | 2.2256 | 0.43 | 1435000 | 0.5109 | 2.25 |
357
+ | 2.2247 | 0.43 | 1440000 | 0.5108 | 2.25 |
358
+ | 2.222 | 0.43 | 1445000 | 0.5108 | 2.25 |
359
+ | 2.2228 | 0.43 | 1450000 | 0.5106 | 2.2480 |
360
+ | 2.2241 | 0.44 | 1455000 | 0.5111 | 2.2480 |
361
+ | 2.2219 | 0.44 | 1460000 | 0.5111 | 2.2461 |
362
+ | 2.2219 | 0.44 | 1465000 | 0.5113 | 2.2461 |
363
+ | 2.2215 | 0.44 | 1470000 | 0.5113 | 2.2461 |
364
+ | 2.2193 | 0.44 | 1475000 | 0.5116 | 2.2441 |
365
+ | 2.2183 | 0.44 | 1480000 | 0.5115 | 2.2441 |
366
+ | 2.2177 | 0.44 | 1485000 | 0.5116 | 2.2441 |
367
+ | 2.2211 | 0.45 | 1490000 | 0.5116 | 2.2422 |
368
+ | 2.2183 | 0.45 | 1495000 | 0.5118 | 2.2422 |
369
+ | 2.2182 | 0.45 | 1500000 | 0.5120 | 2.2402 |
370
+ | 2.2148 | 0.45 | 1505000 | 0.5122 | 2.2402 |
371
+ | 2.2217 | 0.45 | 1510000 | 0.5123 | 2.2402 |
372
+ | 2.2117 | 0.45 | 1515000 | 0.5124 | 2.2383 |
373
+ | 2.2152 | 0.46 | 1520000 | 0.5123 | 2.2383 |
374
+ | 2.2148 | 0.46 | 1525000 | 0.5125 | 2.2383 |
375
+ | 2.2151 | 0.46 | 1530000 | 0.5127 | 2.2363 |
376
+ | 2.2129 | 0.46 | 1535000 | 0.5127 | 2.2363 |
377
+ | 2.2145 | 0.46 | 1540000 | 0.5128 | 2.2363 |
378
+ | 2.2099 | 0.46 | 1545000 | 0.5129 | 2.2363 |
379
+ | 2.2125 | 0.46 | 1550000 | 0.5132 | 2.2344 |
380
+ | 2.2101 | 0.47 | 1555000 | 0.5131 | 2.2344 |
381
+ | 2.211 | 0.47 | 1560000 | 0.5132 | 2.2344 |
382
+ | 2.2086 | 0.47 | 1565000 | 0.5132 | 2.2344 |
383
+ | 2.2137 | 0.47 | 1570000 | 0.5132 | 2.2324 |
384
+ | 2.2122 | 0.47 | 1575000 | 0.5134 | 2.2324 |
385
+ | 2.2053 | 0.47 | 1580000 | 0.5134 | 2.2324 |
386
+ | 2.208 | 0.47 | 1585000 | 0.5134 | 2.2305 |
387
+ | 2.2081 | 0.48 | 1590000 | 0.5136 | 2.2305 |
388
+ | 2.2077 | 0.48 | 1595000 | 0.5138 | 2.2305 |
389
+ | 2.2061 | 0.48 | 1600000 | 0.5136 | 2.2305 |
390
+ | 2.2055 | 0.48 | 1605000 | 0.5139 | 2.2285 |
391
+ | 2.2065 | 0.48 | 1610000 | 0.5139 | 2.2285 |
392
+ | 2.2054 | 0.48 | 1615000 | 0.5139 | 2.2285 |
393
+ | 2.2035 | 0.49 | 1620000 | 0.5140 | 2.2285 |
394
+ | 2.2021 | 0.49 | 1625000 | 0.5140 | 2.2285 |
395
+ | 2.2036 | 0.49 | 1630000 | 0.5138 | 2.2285 |
396
+ | 2.204 | 0.49 | 1635000 | 0.5140 | 2.2266 |
397
+ | 2.2042 | 0.49 | 1640000 | 0.5141 | 2.2266 |
398
+ | 2.2024 | 0.49 | 1645000 | 0.5142 | 2.2266 |
399
+ | 2.2023 | 0.49 | 1650000 | 0.5144 | 2.2266 |
400
+ | 2.1976 | 0.5 | 1655000 | 0.5146 | 2.2246 |
401
+ | 2.2028 | 0.5 | 1660000 | 0.5147 | 2.2246 |
402
+ | 2.1971 | 0.5 | 1665000 | 0.5146 | 2.2246 |
403
+ | 2.1978 | 0.5 | 1670000 | 0.5146 | 2.2246 |
404
+ | 2.1955 | 0.5 | 1675000 | 0.5148 | 2.2227 |
405
+ | 2.1967 | 0.5 | 1680000 | 0.5147 | 2.2227 |
406
+ | 2.1975 | 0.5 | 1685000 | 0.5152 | 2.2227 |
407
+ | 2.1972 | 0.51 | 1690000 | 0.5149 | 2.2207 |
408
+ | 2.1967 | 0.51 | 1695000 | 0.5151 | 2.2207 |
409
+ | 2.194 | 0.51 | 1700000 | 0.5151 | 2.2207 |
410
+ | 2.2009 | 0.51 | 1705000 | 0.5139 | 2.2285 |
411
+ | 2.2085 | 0.51 | 1710000 | 0.5136 | 2.2305 |
412
+ | 2.2077 | 0.51 | 1715000 | 0.5137 | 2.2305 |
413
+ | 2.205 | 0.52 | 1720000 | 0.5134 | 2.2305 |
414
+ | 2.2063 | 0.52 | 1725000 | 0.5134 | 2.2305 |
415
+ | 2.2076 | 0.52 | 1730000 | 0.5135 | 2.2305 |
416
+ | 2.2036 | 0.52 | 1735000 | 0.5133 | 2.2305 |
417
+ | 2.2064 | 0.52 | 1740000 | 0.5138 | 2.2305 |
418
+ | 2.2053 | 0.52 | 1745000 | 0.5137 | 2.2305 |
419
+ | 2.2048 | 0.52 | 1750000 | 0.5139 | 2.2305 |
420
+ | 2.2075 | 0.53 | 1755000 | 0.5138 | 2.2305 |
421
+ | 2.2041 | 0.53 | 1760000 | 0.5136 | 2.2285 |
422
+ | 2.2057 | 0.53 | 1765000 | 0.5139 | 2.2285 |
423
+ | 2.2054 | 0.53 | 1770000 | 0.5139 | 2.2285 |
424
+ | 2.2085 | 0.53 | 1775000 | 0.5139 | 2.2285 |
425
+ | 2.2051 | 0.53 | 1780000 | 0.5141 | 2.2266 |
426
+ | 2.2023 | 0.53 | 1785000 | 0.5139 | 2.2266 |
427
+ | 2.205 | 0.54 | 1790000 | 0.5141 | 2.2266 |
428
+ | 2.2009 | 0.54 | 1795000 | 0.5141 | 2.2266 |
429
+ | 2.1998 | 0.54 | 1800000 | 0.5143 | 2.2266 |
430
+ | 2.2009 | 0.54 | 1805000 | 0.5144 | 2.2246 |
431
+ | 2.2027 | 0.54 | 1810000 | 0.5143 | 2.2266 |
432
+ | 2.2007 | 0.54 | 1815000 | 0.5146 | 2.2246 |
433
+ | 2.1978 | 0.55 | 1820000 | 0.5145 | 2.2246 |
434
+ | 2.1999 | 0.55 | 1825000 | 0.5146 | 2.2227 |
435
+ | 2.1978 | 0.55 | 1830000 | 0.5148 | 2.2227 |
436
+ | 2.1989 | 0.55 | 1835000 | 0.5147 | 2.2227 |
437
+ | 2.1989 | 0.55 | 1840000 | 0.5148 | 2.2227 |
438
+ | 2.1982 | 0.55 | 1845000 | 0.5150 | 2.2207 |
439
+ | 2.1974 | 0.55 | 1850000 | 0.5151 | 2.2207 |
440
+ | 2.1972 | 0.56 | 1855000 | 0.5151 | 2.2207 |
441
+ | 2.1966 | 0.56 | 1860000 | 0.5151 | 2.2207 |
442
+ | 2.198 | 0.56 | 1865000 | 0.5150 | 2.2207 |
443
+ | 2.1978 | 0.56 | 1870000 | 0.5152 | 2.2207 |
444
+ | 2.1938 | 0.56 | 1875000 | 0.5152 | 2.2207 |
445
+ | 2.1908 | 0.56 | 1880000 | 0.5152 | 2.2188 |
446
+ | 2.1899 | 0.56 | 1885000 | 0.5152 | 2.2188 |
447
+ | 2.1938 | 0.57 | 1890000 | 0.5152 | 2.2188 |
448
+ | 2.1909 | 0.57 | 1895000 | 0.5154 | 2.2188 |
449
+ | 2.1921 | 0.57 | 1900000 | 0.5155 | 2.2188 |
450
+ | 2.1926 | 0.57 | 1905000 | 0.5156 | 2.2168 |
451
+ | 2.194 | 0.57 | 1910000 | 0.5154 | 2.2168 |
452
+ | 2.1942 | 0.57 | 1915000 | 0.5152 | 2.2188 |
453
+ | 2.1947 | 0.58 | 1920000 | 0.5151 | 2.2188 |
454
+ | 2.1941 | 0.58 | 1925000 | 0.5151 | 2.2207 |
455
+ | 2.1984 | 0.58 | 1930000 | 0.5152 | 2.2207 |
456
+ | 2.1929 | 0.58 | 1935000 | 0.5151 | 2.2207 |
457
+ | 2.1921 | 0.58 | 1940000 | 0.5154 | 2.2188 |
458
+ | 2.1932 | 0.58 | 1945000 | 0.5153 | 2.2188 |
459
+ | 2.1959 | 0.58 | 1950000 | 0.5154 | 2.2188 |
460
+ | 2.1927 | 0.59 | 1955000 | 0.5154 | 2.2188 |
461
+ | 2.1949 | 0.59 | 1960000 | 0.5155 | 2.2188 |
462
+ | 2.1918 | 0.59 | 1965000 | 0.5154 | 2.2168 |
463
+ | 2.1957 | 0.59 | 1970000 | 0.5155 | 2.2168 |
464
+ | 2.1884 | 0.59 | 1975000 | 0.5157 | 2.2168 |
465
+ | 2.1942 | 0.59 | 1980000 | 0.5156 | 2.2148 |
466
+ | 2.1938 | 0.59 | 1985000 | 0.5156 | 2.2168 |
467
+ | 2.1935 | 0.6 | 1990000 | 0.5160 | 2.2148 |
468
+ | 2.1902 | 0.6 | 1995000 | 0.5157 | 2.2148 |
469
+ | 2.188 | 0.6 | 2000000 | 0.5158 | 2.2148 |
470
+ | 2.1862 | 0.6 | 2005000 | 0.5159 | 2.2129 |
471
+ | 2.1886 | 0.6 | 2010000 | 0.5161 | 2.2129 |
472
+ | 2.1811 | 0.6 | 2015000 | 0.5161 | 2.2129 |
473
+ | 2.19 | 0.61 | 2020000 | 0.5160 | 2.2129 |
474
+ | 2.1895 | 0.61 | 2025000 | 0.5165 | 2.2129 |
475
+ | 2.1904 | 0.61 | 2030000 | 0.5161 | 2.2129 |
476
+ | 2.1854 | 0.61 | 2035000 | 0.5165 | 2.2129 |
477
+ | 2.1883 | 0.61 | 2040000 | 0.5165 | 2.2109 |
478
+ | 2.1859 | 0.61 | 2045000 | 0.5165 | 2.2109 |
479
+ | 2.1849 | 0.61 | 2050000 | 0.5168 | 2.2090 |
480
+ | 2.1844 | 0.62 | 2055000 | 0.5167 | 2.2109 |
481
+ | 2.1866 | 0.62 | 2060000 | 0.5167 | 2.2090 |
482
+ | 2.1865 | 0.62 | 2065000 | 0.5168 | 2.2090 |
483
+ | 2.1846 | 0.62 | 2070000 | 0.5171 | 2.2070 |
484
+ | 2.1821 | 0.62 | 2075000 | 0.5170 | 2.2070 |
485
+ | 2.184 | 0.62 | 2080000 | 0.5170 | 2.2070 |
486
+ | 2.1847 | 0.62 | 2085000 | 0.5173 | 2.2051 |
487
+ | 2.1836 | 0.63 | 2090000 | 0.5174 | 2.2051 |
488
+ | 2.1791 | 0.63 | 2095000 | 0.5174 | 2.2051 |
489
+ | 2.1812 | 0.63 | 2100000 | 0.5173 | 2.2051 |
490
+ | 2.1835 | 0.63 | 2105000 | 0.5176 | 2.2051 |
491
+ | 2.1806 | 0.63 | 2110000 | 0.5176 | 2.2051 |
492
+ | 2.1832 | 0.63 | 2115000 | 0.5175 | 2.2051 |
493
+ | 2.1766 | 0.64 | 2120000 | 0.5178 | 2.2031 |
494
+ | 2.1775 | 0.64 | 2125000 | 0.5178 | 2.2031 |
495
+ | 2.1801 | 0.64 | 2130000 | 0.5177 | 2.2031 |
496
+ | 2.1789 | 0.64 | 2135000 | 0.5178 | 2.2031 |
497
+ | 2.1794 | 0.64 | 2140000 | 0.5178 | 2.2031 |
498
+ | 2.1799 | 0.64 | 2145000 | 0.5179 | 2.2012 |
499
+ | 2.1746 | 0.64 | 2150000 | 0.5180 | 2.2012 |
500
+ | 2.1766 | 0.65 | 2155000 | 0.5179 | 2.2012 |
501
+ | 2.1754 | 0.65 | 2160000 | 0.5177 | 2.2012 |
502
+ | 2.1764 | 0.65 | 2165000 | 0.5177 | 2.2012 |
503
+ | 2.1745 | 0.65 | 2170000 | 0.5183 | 2.1992 |
504
+ | 2.1735 | 0.65 | 2175000 | 0.5180 | 2.1992 |
505
+ | 2.1778 | 0.65 | 2180000 | 0.5181 | 2.1992 |
506
+ | 2.1717 | 0.65 | 2185000 | 0.5183 | 2.1992 |
507
+ | 2.1752 | 0.66 | 2190000 | 0.5185 | 2.1973 |
508
+ | 2.1747 | 0.66 | 2195000 | 0.5185 | 2.1973 |
509
+ | 2.1754 | 0.66 | 2200000 | 0.5186 | 2.1973 |
510
+ | 2.1728 | 0.66 | 2205000 | 0.5188 | 2.1973 |
511
+ | 2.1684 | 0.66 | 2210000 | 0.5186 | 2.1973 |
512
+ | 2.1722 | 0.66 | 2215000 | 0.5188 | 2.1953 |
513
+ | 2.1692 | 0.67 | 2220000 | 0.5190 | 2.1953 |
514
+ | 2.176 | 0.67 | 2225000 | 0.5191 | 2.1953 |
515
+ | 2.1697 | 0.67 | 2230000 | 0.5190 | 2.1953 |
516
+ | 2.1731 | 0.67 | 2235000 | 0.5191 | 2.1953 |
517
+ | 2.173 | 0.67 | 2240000 | 0.5191 | 2.1934 |
518
+ | 2.1714 | 0.67 | 2245000 | 0.5193 | 2.1934 |
519
+ | 2.1719 | 0.67 | 2250000 | 0.5192 | 2.1934 |
520
+ | 2.1667 | 0.68 | 2255000 | 0.5190 | 2.1934 |
521
+ | 2.1653 | 0.68 | 2260000 | 0.5192 | 2.1934 |
522
+ | 2.1656 | 0.68 | 2265000 | 0.5193 | 2.1914 |
523
+ | 2.1695 | 0.68 | 2270000 | 0.5194 | 2.1914 |
524
+ | 2.17 | 0.68 | 2275000 | 0.5196 | 2.1914 |
525
+ | 2.1628 | 0.68 | 2280000 | 0.5197 | 2.1914 |
526
+ | 2.1648 | 0.68 | 2285000 | 0.5196 | 2.1895 |
527
+ | 2.1647 | 0.69 | 2290000 | 0.5199 | 2.1895 |
528
+ | 2.1648 | 0.69 | 2295000 | 0.5198 | 2.1895 |
529
+ | 2.168 | 0.69 | 2300000 | 0.5197 | 2.1895 |
530
+ | 2.1607 | 0.69 | 2305000 | 0.5198 | 2.1895 |
531
+ | 2.1674 | 0.69 | 2310000 | 0.5200 | 2.1875 |
532
+ | 2.1656 | 0.69 | 2315000 | 0.5200 | 2.1875 |
533
+ | 2.1637 | 0.7 | 2320000 | 0.5202 | 2.1875 |
534
+ | 2.1649 | 0.7 | 2325000 | 0.5201 | 2.1875 |
535
+ | 2.1625 | 0.7 | 2330000 | 0.5201 | 2.1875 |
536
+ | 2.1627 | 0.7 | 2335000 | 0.5203 | 2.1875 |
537
+ | 2.1598 | 0.7 | 2340000 | 0.5203 | 2.1855 |
538
+ | 2.1638 | 0.7 | 2345000 | 0.5201 | 2.1875 |
539
+ | 2.1588 | 0.7 | 2350000 | 0.5205 | 2.1855 |
540
+ | 2.1633 | 0.71 | 2355000 | 0.5205 | 2.1855 |
541
+ | 2.1621 | 0.71 | 2360000 | 0.5205 | 2.1855 |
542
+ | 2.165 | 0.71 | 2365000 | 0.5207 | 2.1836 |
543
+ | 2.159 | 0.71 | 2370000 | 0.5206 | 2.1836 |
544
+ | 2.1573 | 0.71 | 2375000 | 0.5207 | 2.1836 |
545
+ | 2.1556 | 0.71 | 2380000 | 0.5208 | 2.1836 |
546
+ | 2.1562 | 0.71 | 2385000 | 0.5210 | 2.1836 |
547
+ | 2.1572 | 0.72 | 2390000 | 0.5209 | 2.1836 |
548
+ | 2.1577 | 0.72 | 2395000 | 0.5209 | 2.1816 |
549
+ | 2.1529 | 0.72 | 2400000 | 0.5210 | 2.1816 |
550
+ | 2.1636 | 0.72 | 2405000 | 0.5211 | 2.1816 |
551
+ | 2.1521 | 0.72 | 2410000 | 0.5213 | 2.1816 |
552
+ | 2.1574 | 0.72 | 2415000 | 0.5214 | 2.1816 |
553
+ | 2.1546 | 0.72 | 2420000 | 0.5213 | 2.1797 |
554
+ | 2.1572 | 0.73 | 2425000 | 0.5212 | 2.1797 |
555
+ | 2.1544 | 0.73 | 2430000 | 0.5212 | 2.1797 |
556
+ | 2.15 | 0.73 | 2435000 | 0.5213 | 2.1797 |
557
+ | 2.1537 | 0.73 | 2440000 | 0.5217 | 2.1777 |
558
+ | 2.1552 | 0.73 | 2445000 | 0.5216 | 2.1777 |
559
+ | 2.1522 | 0.73 | 2450000 | 0.5215 | 2.1777 |
560
+ | 2.1487 | 0.74 | 2455000 | 0.5215 | 2.1777 |
561
+ | 2.1582 | 0.74 | 2460000 | 0.5215 | 2.1777 |
562
+ | 2.1582 | 0.74 | 2465000 | 0.5218 | 2.1777 |
563
+ | 2.1529 | 0.74 | 2470000 | 0.5218 | 2.1777 |
564
+ | 2.1549 | 0.74 | 2475000 | 0.5219 | 2.1758 |
565
+ | 2.1525 | 0.74 | 2480000 | 0.5219 | 2.1758 |
566
+ | 2.1478 | 0.74 | 2485000 | 0.5221 | 2.1758 |
567
+ | 2.1524 | 0.75 | 2490000 | 0.5220 | 2.1758 |
568
+ | 2.1477 | 0.75 | 2495000 | 0.5220 | 2.1738 |
569
+ | 2.1524 | 0.75 | 2500000 | 0.5222 | 2.1738 |
570
+ | 2.147 | 0.75 | 2505000 | 0.5222 | 2.1738 |
571
+ | 2.1481 | 0.75 | 2510000 | 0.5223 | 2.1738 |
572
+ | 2.1494 | 0.75 | 2515000 | 0.5223 | 2.1738 |
573
+ | 2.1484 | 0.75 | 2520000 | 0.5223 | 2.1738 |
574
+ | 2.1474 | 0.76 | 2525000 | 0.5223 | 2.1738 |
575
+ | 2.1487 | 0.76 | 2530000 | 0.5223 | 2.1738 |
576
+ | 2.1465 | 0.76 | 2535000 | 0.5225 | 2.1719 |
577
+ | 2.1456 | 0.76 | 2540000 | 0.5226 | 2.1719 |
578
+ | 2.1482 | 0.76 | 2545000 | 0.5224 | 2.1719 |
579
+ | 2.1451 | 0.76 | 2550000 | 0.5226 | 2.1719 |
580
+ | 2.143 | 0.77 | 2555000 | 0.5226 | 2.1719 |
581
+ | 2.1463 | 0.77 | 2560000 | 0.5225 | 2.1719 |
582
+ | 2.1466 | 0.77 | 2565000 | 0.5228 | 2.1699 |
583
+ | 2.1423 | 0.77 | 2570000 | 0.5229 | 2.1699 |
584
+ | 2.1423 | 0.77 | 2575000 | 0.5231 | 2.1699 |
585
+ | 2.1444 | 0.77 | 2580000 | 0.5230 | 2.1699 |
586
+ | 2.1402 | 0.77 | 2585000 | 0.5230 | 2.1680 |
587
+ | 2.1376 | 0.78 | 2590000 | 0.5231 | 2.1680 |
588
+ | 2.1395 | 0.78 | 2595000 | 0.5232 | 2.1680 |
589
+ | 2.1399 | 0.78 | 2600000 | 0.5233 | 2.1680 |
590
+ | 2.1379 | 0.78 | 2605000 | 0.5231 | 2.1680 |
591
+ | 2.1411 | 0.78 | 2610000 | 0.5234 | 2.1660 |
592
+ | 2.1421 | 0.78 | 2615000 | 0.5232 | 2.1660 |
593
+ | 2.1412 | 0.78 | 2620000 | 0.5237 | 2.1660 |
594
+ | 2.1381 | 0.79 | 2625000 | 0.5236 | 2.1660 |
595
+ | 2.142 | 0.79 | 2630000 | 0.5236 | 2.1660 |
596
+ | 2.1394 | 0.79 | 2635000 | 0.5236 | 2.1641 |
597
+ | 2.1384 | 0.79 | 2640000 | 0.5234 | 2.1641 |
598
+ | 2.138 | 0.79 | 2645000 | 0.5236 | 2.1641 |
599
+ | 2.1346 | 0.79 | 2650000 | 0.5239 | 2.1641 |
600
+ | 2.1376 | 0.8 | 2655000 | 0.5239 | 2.1641 |
601
+ | 2.1409 | 0.8 | 2660000 | 0.5240 | 2.1641 |
602
+ | 2.1343 | 0.8 | 2665000 | 0.5240 | 2.1641 |
603
+ | 2.1363 | 0.8 | 2670000 | 0.5240 | 2.1621 |
604
+ | 2.1343 | 0.8 | 2675000 | 0.5242 | 2.1621 |
605
+ | 2.1381 | 0.8 | 2680000 | 0.5243 | 2.1621 |
606
+ | 2.1355 | 0.8 | 2685000 | 0.5241 | 2.1621 |
607
+ | 2.1394 | 0.81 | 2690000 | 0.5242 | 2.1602 |
608
+ | 2.1359 | 0.81 | 2695000 | 0.5245 | 2.1602 |
609
+ | 2.1365 | 0.81 | 2700000 | 0.5244 | 2.1602 |
610
+ | 2.131 | 0.81 | 2705000 | 0.5244 | 2.1602 |
611
+ | 2.1337 | 0.81 | 2710000 | 0.5244 | 2.1602 |
612
+ | 2.1307 | 0.81 | 2715000 | 0.5246 | 2.1582 |
613
+ | 2.1333 | 0.81 | 2720000 | 0.5247 | 2.1582 |
614
+ | 2.1354 | 0.82 | 2725000 | 0.5246 | 2.1582 |
615
+ | 2.1372 | 0.82 | 2730000 | 0.5248 | 2.1582 |
616
+ | 2.1323 | 0.82 | 2735000 | 0.5248 | 2.1582 |
617
+ | 2.1315 | 0.82 | 2740000 | 0.5249 | 2.1562 |
618
+ | 2.1341 | 0.82 | 2745000 | 0.5249 | 2.1562 |
619
+ | 2.132 | 0.82 | 2750000 | 0.5250 | 2.1562 |
620
+ | 2.1322 | 0.83 | 2755000 | 0.5252 | 2.1562 |
621
+ | 2.1298 | 0.83 | 2760000 | 0.5252 | 2.1562 |
622
+ | 2.1285 | 0.83 | 2765000 | 0.5252 | 2.1543 |
623
+ | 2.1299 | 0.83 | 2770000 | 0.5252 | 2.1562 |
624
+ | 2.1304 | 0.83 | 2775000 | 0.5253 | 2.1543 |
625
+ | 2.1288 | 0.83 | 2780000 | 0.5254 | 2.1543 |
626
+ | 2.1295 | 0.83 | 2785000 | 0.5253 | 2.1543 |
627
+ | 2.129 | 0.84 | 2790000 | 0.5255 | 2.1543 |
628
+ | 2.1285 | 0.84 | 2795000 | 0.5254 | 2.1543 |
629
+ | 2.1292 | 0.84 | 2800000 | 0.5253 | 2.1543 |
630
+ | 2.1278 | 0.84 | 2805000 | 0.5256 | 2.1523 |
631
+ | 2.1239 | 0.84 | 2810000 | 0.5255 | 2.1523 |
632
+ | 2.1241 | 0.84 | 2815000 | 0.5259 | 2.1523 |
633
+ | 2.1232 | 0.84 | 2820000 | 0.5257 | 2.1523 |
634
+ | 2.1241 | 0.85 | 2825000 | 0.5257 | 2.1504 |
635
+ | 2.1236 | 0.85 | 2830000 | 0.5259 | 2.1504 |
636
+ | 2.1272 | 0.85 | 2835000 | 0.5259 | 2.1504 |
637
+ | 2.1271 | 0.85 | 2840000 | 0.5261 | 2.1504 |
638
+ | 2.1249 | 0.85 | 2845000 | 0.5262 | 2.1484 |
639
+ | 2.1245 | 0.85 | 2850000 | 0.5260 | 2.1484 |
640
+ | 2.1222 | 0.86 | 2855000 | 0.5261 | 2.1484 |
641
+ | 2.125 | 0.86 | 2860000 | 0.5263 | 2.1484 |
642
+ | 2.1261 | 0.86 | 2865000 | 0.5261 | 2.1484 |
643
+ | 2.1247 | 0.86 | 2870000 | 0.5262 | 2.1484 |
644
+ | 2.1225 | 0.86 | 2875000 | 0.5263 | 2.1484 |
645
+ | 2.122 | 0.86 | 2880000 | 0.5261 | 2.1484 |
646
+ | 2.1237 | 0.86 | 2885000 | 0.5261 | 2.1465 |
647
+ | 2.1219 | 0.87 | 2890000 | 0.5262 | 2.1465 |
648
+ | 2.1248 | 0.87 | 2895000 | 0.5262 | 2.1465 |
649
+ | 2.1191 | 0.87 | 2900000 | 0.5264 | 2.1465 |
650
+ | 2.1181 | 0.87 | 2905000 | 0.5264 | 2.1465 |
651
+ | 2.1176 | 0.87 | 2910000 | 0.5263 | 2.1465 |
652
+ | 2.1191 | 0.87 | 2915000 | 0.5267 | 2.1465 |
653
+ | 2.1206 | 0.87 | 2920000 | 0.5268 | 2.1445 |
654
+ | 2.1148 | 0.88 | 2925000 | 0.5267 | 2.1445 |
655
+ | 2.1188 | 0.88 | 2930000 | 0.5270 | 2.1445 |
656
+ | 2.1118 | 0.88 | 2935000 | 0.5270 | 2.1445 |
657
+ | 2.1283 | 0.88 | 2940000 | 2.1582 | 0.5244 |
658
+ | 2.1336 | 0.88 | 2945000 | 2.1621 | 0.5240 |
659
+ | 2.1311 | 0.88 | 2950000 | 2.1621 | 0.5237 |
660
+ | 2.1377 | 0.89 | 2955000 | 2.1641 | 0.5236 |
661
+ | 2.136 | 0.89 | 2960000 | 2.1641 | 0.5236 |
662
+ | 2.1394 | 0.89 | 2965000 | 2.1641 | 0.5233 |
663
+ | 2.1405 | 0.89 | 2970000 | 2.1660 | 0.5233 |
664
+ | 2.1391 | 0.89 | 2975000 | 2.1660 | 0.5236 |
665
+ | 2.1353 | 0.89 | 2980000 | 2.1660 | 0.5234 |
666
+ | 2.1392 | 0.89 | 2985000 | 2.1660 | 0.5234 |
667
+ | 2.1384 | 0.9 | 2990000 | 2.1660 | 0.5235 |
668
+ | 2.1373 | 0.9 | 2995000 | 2.1660 | 0.5233 |
669
+ | 2.1346 | 0.9 | 3000000 | 2.1660 | 0.5234 |
670
+ | 2.1368 | 0.9 | 3005000 | 2.1660 | 0.5235 |
671
+ | 2.1383 | 0.9 | 3010000 | 2.1660 | 0.5233 |
672
+ | 2.1447 | 0.9 | 3015000 | 2.1660 | 0.5233 |
673
+ | 2.1392 | 0.9 | 3020000 | 2.1660 | 0.5234 |
674
+ | 2.1359 | 0.91 | 3025000 | 2.1660 | 0.5233 |
675
+ | 2.1408 | 0.91 | 3030000 | 2.1660 | 0.5233 |
676
+ | 2.1437 | 0.91 | 3035000 | 2.1660 | 0.5233 |
677
+ | 2.1354 | 0.91 | 3040000 | 2.1660 | 0.5233 |
678
+ | 2.1371 | 0.91 | 3045000 | 2.1660 | 0.5235 |
679
+ | 2.1399 | 0.91 | 3050000 | 2.1660 | 0.5234 |
680
+ | 2.1387 | 0.92 | 3055000 | 2.1660 | 0.5234 |
681
+ | 2.1406 | 0.92 | 3060000 | 2.1660 | 0.5232 |
682
+ | 2.1387 | 0.92 | 3065000 | 2.1660 | 0.5235 |
683
+ | 2.1413 | 0.92 | 3070000 | 2.1660 | 0.5235 |
684
+ | 2.1371 | 0.92 | 3075000 | 2.1641 | 0.5235 |
685
+ | 2.138 | 0.92 | 3080000 | 2.1641 | 0.5235 |
686
+ | 2.1385 | 0.92 | 3085000 | 2.1641 | 0.5236 |
687
+ | 2.135 | 0.93 | 3090000 | 2.1660 | 0.5234 |
688
+ | 2.1401 | 0.93 | 3095000 | 2.1641 | 0.5236 |
689
+ | 2.1374 | 0.93 | 3100000 | 2.1641 | 0.5236 |
690
+ | 2.1358 | 0.93 | 3105000 | 2.1641 | 0.5237 |
691
+ | 2.1344 | 0.93 | 3110000 | 2.1621 | 0.5239 |
692
+ | 2.1368 | 0.93 | 3115000 | 2.1621 | 0.5239 |
693
+ | 2.1345 | 0.93 | 3120000 | 2.1621 | 0.5237 |
694
+ | 2.1358 | 0.94 | 3125000 | 2.1621 | 0.5239 |
695
+ | 2.1395 | 0.94 | 3130000 | 2.1621 | 0.5239 |
696
+ | 2.1359 | 0.94 | 3135000 | 2.1621 | 0.5243 |
697
+ | 2.1373 | 0.94 | 3140000 | 2.1602 | 0.5242 |
698
+ | 2.1357 | 0.94 | 3145000 | 2.1602 | 0.5243 |
699
+ | 2.1354 | 0.94 | 3150000 | 2.1602 | 0.5244 |
700
+ | 2.1323 | 0.95 | 3155000 | 2.1602 | 0.5244 |
701
+ | 2.133 | 0.95 | 3160000 | 2.1602 | 0.5242 |
702
+ | 2.1315 | 0.95 | 3165000 | 2.1602 | 0.5244 |
703
+ | 2.1363 | 0.95 | 3170000 | 2.1602 | 0.5243 |
704
+ | 2.1349 | 0.95 | 3175000 | 2.1602 | 0.5245 |
705
+ | 2.1336 | 0.95 | 3180000 | 2.1602 | 0.5244 |
706
+ | 2.1364 | 0.95 | 3185000 | 2.1582 | 0.5244 |
707
+ | 2.133 | 0.96 | 3190000 | 2.1582 | 0.5243 |
708
+ | 2.1349 | 0.96 | 3195000 | 2.1582 | 0.5245 |
709
+ | 2.134 | 0.96 | 3200000 | 2.1582 | 0.5246 |
710
+ | 2.1308 | 0.96 | 3205000 | 2.1562 | 0.5249 |
711
+ | 2.1302 | 0.96 | 3210000 | 2.1562 | 0.5247 |
712
+ | 2.1302 | 0.96 | 3215000 | 2.1562 | 0.5247 |
713
+ | 2.1331 | 0.96 | 3220000 | 2.1562 | 0.5248 |
714
+ | 2.1273 | 0.97 | 3225000 | 2.1562 | 0.5247 |
715
+ | 2.1286 | 0.97 | 3230000 | 2.1562 | 0.5250 |
716
+ | 2.1282 | 0.97 | 3235000 | 2.1543 | 0.5250 |
717
+ | 2.1309 | 0.97 | 3240000 | 2.1543 | 0.5251 |
718
+ | 2.1295 | 0.97 | 3245000 | 2.1543 | 0.5254 |
719
+ | 2.1275 | 0.97 | 3250000 | 2.1543 | 0.5254 |
720
+ | 2.133 | 0.98 | 3255000 | 2.1543 | 0.5254 |
721
+ | 2.1301 | 0.98 | 3260000 | 2.1543 | 0.5251 |
722
+ | 2.1314 | 0.98 | 3265000 | 2.1523 | 0.5253 |
723
+ | 2.1258 | 0.98 | 3270000 | 2.1523 | 0.5255 |
724
+ | 2.1286 | 0.98 | 3275000 | 2.1523 | 0.5254 |
725
+ | 2.1267 | 0.98 | 3280000 | 2.1523 | 0.5254 |
726
+ | 2.13 | 0.98 | 3285000 | 2.1523 | 0.5254 |
727
+ | 2.1284 | 0.99 | 3290000 | 2.1523 | 0.5255 |
728
+ | 2.1295 | 0.99 | 3295000 | 2.1523 | 0.5254 |
729
+ | 2.1241 | 0.99 | 3300000 | 2.1523 | 0.5256 |
730
+ | 2.1297 | 0.99 | 3305000 | 2.1523 | 0.5258 |
731
+ | 2.126 | 0.99 | 3310000 | 2.1504 | 0.5256 |
732
+ | 2.1263 | 0.99 | 3315000 | 2.1504 | 0.5256 |
733
+ | 2.1273 | 0.99 | 3320000 | 2.1504 | 0.5256 |
734
+ | 2.1214 | 1.0 | 3325000 | 2.1504 | 0.5255 |
735
+ | 2.1275 | 1.0 | 3330000 | 2.1504 | 0.5256 |
736
+ | 2.1227 | 1.0 | 3335000 | 2.1504 | 0.5258 |
737
+
738
+
739
+ ### Framework versions
740
+
741
+ - Transformers 4.30.2
742
+ - Pytorch 2.0.0
743
+ - Datasets 2.13.1
744
+ - Tokenizers 0.13.3
all_results.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 1.0,
3
+ "eval_accuracy": 0.5258444783433934,
4
+ "eval_loss": 2.150390625,
5
+ "eval_runtime": 41.4599,
6
+ "eval_samples": 3568,
7
+ "eval_samples_per_second": 86.059,
8
+ "eval_steps_per_second": 10.757,
9
+ "perplexity": 8.5882125125473,
10
+ "train_loss": 0.2576859601399347,
11
+ "train_runtime": 150388.7494,
12
+ "train_samples": 26705019,
13
+ "train_samples_per_second": 177.573,
14
+ "train_steps_per_second": 22.197
15
+ }
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/bscdata/models/falcon_7b_balanced_tokenizer_fp16/",
3
+ "alibi": false,
4
+ "apply_residual_connection_post_layernorm": false,
5
+ "architectures": [
6
+ "RWForCausalLM"
7
+ ],
8
+ "attention_dropout": 0.0,
9
+ "auto_map": {
10
+ "AutoConfig": "configuration_RW.RWConfig",
11
+ "AutoModel": "modelling_RW.RWModel",
12
+ "AutoModelForCausalLM": "modelling_RW.RWForCausalLM",
13
+ "AutoModelForQuestionAnswering": "modelling_RW.RWForQuestionAnswering",
14
+ "AutoModelForSequenceClassification": "modelling_RW.RWForSequenceClassification",
15
+ "AutoModelForTokenClassification": "modelling_RW.RWForTokenClassification"
16
+ },
17
+ "bias": false,
18
+ "bos_token_id": 50256,
19
+ "eos_token_id": 50256,
20
+ "hidden_dropout": 0.0,
21
+ "hidden_size": 4544,
22
+ "initializer_range": 0.02,
23
+ "layer_norm_epsilon": 1e-05,
24
+ "model_type": "RefinedWebModel",
25
+ "multi_query": true,
26
+ "n_head": 71,
27
+ "n_layer": 32,
28
+ "pad_token_id": 50256,
29
+ "parallel_attn": true,
30
+ "torch_dtype": "float16",
31
+ "transformers_version": "4.30.2",
32
+ "use_cache": true,
33
+ "vocab_size": 50257
34
+ }
configuration_RW.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2022 the Big Science Workshop and HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """ Bloom configuration"""
16
+ from transformers.configuration_utils import PretrainedConfig
17
+ from transformers.utils import logging
18
+
19
+
20
+ logger = logging.get_logger(__name__)
21
+
22
+
23
+ class RWConfig(PretrainedConfig):
24
+ model_type = "RefinedWebModel"
25
+ keys_to_ignore_at_inference = ["past_key_values"]
26
+ attribute_map = {
27
+ "num_hidden_layers": "n_layer",
28
+ "num_attention_heads": "n_head",
29
+ }
30
+
31
+ def __init__(
32
+ self,
33
+ vocab_size=250880,
34
+ hidden_size=64,
35
+ n_layer=2,
36
+ n_head=8,
37
+ layer_norm_epsilon=1e-5,
38
+ initializer_range=0.02,
39
+ use_cache=True,
40
+ bos_token_id=1,
41
+ eos_token_id=2,
42
+ apply_residual_connection_post_layernorm=False,
43
+ hidden_dropout=0.0,
44
+ attention_dropout=0.0,
45
+ multi_query=False,
46
+ alibi=False,
47
+ bias=False,
48
+ parallel_attn=False,
49
+ **kwargs,
50
+ ):
51
+ self.vocab_size = vocab_size
52
+ # Backward compatibility with n_embed kwarg
53
+ n_embed = kwargs.pop("n_embed", None)
54
+ self.hidden_size = hidden_size if n_embed is None else n_embed
55
+ self.n_layer = n_layer
56
+ self.n_head = n_head
57
+ self.layer_norm_epsilon = layer_norm_epsilon
58
+ self.initializer_range = initializer_range
59
+ self.use_cache = use_cache
60
+ self.apply_residual_connection_post_layernorm = apply_residual_connection_post_layernorm
61
+ self.hidden_dropout = hidden_dropout
62
+ self.attention_dropout = attention_dropout
63
+
64
+ self.bos_token_id = bos_token_id
65
+ self.eos_token_id = eos_token_id
66
+ self.multi_query = multi_query
67
+ self.alibi = alibi
68
+ self.bias = bias
69
+ self.parallel_attn = parallel_attn
70
+
71
+ super().__init__(bos_token_id=bos_token_id, eos_token_id=eos_token_id, **kwargs)
72
+
73
+ @property
74
+ def head_dim(self):
75
+ return self.hidden_size // self.n_head
76
+
77
+ @property
78
+ def rotary(self):
79
+ return not self.alibi
eval_results.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 1.0,
3
+ "eval_accuracy": 0.5258444783433934,
4
+ "eval_loss": 2.150390625,
5
+ "eval_runtime": 41.4599,
6
+ "eval_samples": 3568,
7
+ "eval_samples_per_second": 86.059,
8
+ "eval_steps_per_second": 10.757,
9
+ "perplexity": 8.5882125125473
10
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.30.2"
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
modelling_RW.py ADDED
@@ -0,0 +1,1100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # port of models described in RW
2
+ # We use the bloom model as a starting point for these model.
3
+ # Please refer to the bloom models for usage instructions.
4
+
5
+ import math
6
+ import warnings
7
+ from typing import Optional, Tuple, Union
8
+
9
+ import torch
10
+ import torch.utils.checkpoint
11
+ from torch import nn
12
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
13
+ from torch.nn import functional as F
14
+
15
+ from transformers.modeling_outputs import (
16
+ BaseModelOutputWithPastAndCrossAttentions,
17
+ CausalLMOutputWithCrossAttentions,
18
+ QuestionAnsweringModelOutput,
19
+ SequenceClassifierOutputWithPast,
20
+ TokenClassifierOutput,
21
+ )
22
+ from transformers.modeling_utils import PreTrainedModel
23
+ from transformers.utils import logging
24
+ from .configuration_RW import RWConfig
25
+
26
+ logger = logging.get_logger(__name__)
27
+
28
+ # NOTE(Hesslow): Unfortunately we did not fuse matmul and bias during training, this means that there's one additional quantization to bfloat16 between the operations.
29
+ # In order not to degrade the quality of our HF-port, we keep these characteristics in the final model.
30
+ class Linear(nn.Linear):
31
+ def forward(self, input: torch.Tensor) -> torch.Tensor:
32
+ ret = input @ self.weight.T
33
+ if self.bias is None:
34
+ return ret
35
+ else:
36
+ return ret + self.bias
37
+
38
+
39
+ from einops import rearrange
40
+
41
+ # rotary pos emb helpers (torch.jit.script does not seem to support staticmethod...)
42
+ def rotate_half(x):
43
+ x1, x2 = x[..., : x.shape[-1] // 2], x[..., x.shape[-1] // 2 :]
44
+ return torch.cat((-x2, x1), dim=x1.ndim - 1) # dim=-1 triggers a bug in torch < 1.8.0
45
+
46
+
47
+ class RotaryEmbedding(torch.nn.Module):
48
+ """Implementation of RotaryEmbedding from GPT-NeoX.
49
+ This implementation is design to operate on queries and keys that are compatible with
50
+ [batch_size, n_heads_per_partition, seq_len, head_dim] (e.g. MinGPTAttention format).
51
+ """
52
+
53
+ def __init__(
54
+ self,
55
+ head_dim: int,
56
+ base=10000,
57
+ ):
58
+ super().__init__()
59
+ inv_freq = 1.0 / (base ** (torch.arange(0, head_dim, 2).float() / head_dim))
60
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
61
+ self.head_dim = head_dim
62
+ self.seq_len_cached = None
63
+ self.batch_size_cached = None
64
+ self.cos_cached: torch.Tensor | None = None
65
+ self.sin_cached: torch.Tensor | None = None
66
+
67
+ def cos_sin(
68
+ self,
69
+ seq_len: int,
70
+ device="cuda",
71
+ dtype=torch.bfloat16,
72
+ ) -> torch.Tensor:
73
+ if seq_len != self.seq_len_cached:
74
+ self.seq_len_cached = seq_len
75
+ t = torch.arange(seq_len, device=device).type_as(self.inv_freq)
76
+ freqs = torch.einsum("i,j->ij", t, self.inv_freq)
77
+ emb = torch.cat((freqs, freqs), dim=-1).to(device)
78
+
79
+ if dtype in [torch.float16, torch.bfloat16]:
80
+ emb = emb.float()
81
+
82
+ self.cos_cached = emb.cos()[None, :, :]
83
+ self.sin_cached = emb.sin()[None, :, :]
84
+
85
+ self.cos_cached = self.cos_cached.type(dtype)
86
+ self.sin_cached = self.sin_cached.type(dtype)
87
+
88
+ return self.cos_cached, self.sin_cached
89
+
90
+ def forward(self, q, k):
91
+ batch, seq_len, head_dim = q.shape
92
+ cos, sin = self.cos_sin(seq_len, q.device, q.dtype)
93
+ return (q * cos) + (rotate_half(q) * sin), (k * cos) + (rotate_half(k) * sin)
94
+
95
+
96
+ def _make_causal_mask(
97
+ input_ids_shape: torch.Size, device: torch.device, past_key_values_length: int
98
+ ) -> torch.BoolTensor:
99
+ batch_size, target_length = input_ids_shape
100
+ mask = torch.empty((target_length, target_length + past_key_values_length), dtype=torch.bool, device=device)
101
+ # ONNX doesn't support `torch.Tensor.triu` properly, thus we use this workaround
102
+ seq_ids = torch.arange(target_length, device=device)
103
+ mask[:, past_key_values_length:] = seq_ids[:, None] < seq_ids[None, :]
104
+
105
+ if past_key_values_length > 0:
106
+ mask[:, :past_key_values_length] = False
107
+
108
+ expanded_mask = mask[None, None, :, :].expand(batch_size, 1, target_length, target_length + past_key_values_length)
109
+ return expanded_mask
110
+
111
+
112
+ def _expand_mask(mask: torch.Tensor, tgt_length: int) -> torch.BoolTensor:
113
+ batch_size, src_length = mask.shape
114
+ tgt_length = tgt_length if tgt_length is not None else src_length
115
+
116
+ expanded_mask = ~(mask[:, None, None, :].to(torch.bool))
117
+ return expanded_mask.expand(batch_size, 1, tgt_length, src_length)
118
+
119
+
120
+ def build_alibi_tensor(attention_mask: torch.Tensor, num_heads: int, dtype: torch.dtype) -> torch.Tensor:
121
+ batch_size, seq_length = attention_mask.shape
122
+ closest_power_of_2 = 2 ** math.floor(math.log2(num_heads))
123
+ base = torch.tensor(
124
+ 2 ** (-(2 ** -(math.log2(closest_power_of_2) - 3))), device=attention_mask.device, dtype=torch.float32
125
+ )
126
+ powers = torch.arange(1, 1 + closest_power_of_2, device=attention_mask.device, dtype=torch.int32)
127
+ slopes = torch.pow(base, powers)
128
+
129
+ if closest_power_of_2 != num_heads:
130
+ extra_base = torch.tensor(
131
+ 2 ** (-(2 ** -(math.log2(2 * closest_power_of_2) - 3))), device=attention_mask.device, dtype=torch.float32
132
+ )
133
+ num_remaining_heads = min(closest_power_of_2, num_heads - closest_power_of_2)
134
+ extra_powers = torch.arange(1, 1 + 2 * num_remaining_heads, 2, device=attention_mask.device, dtype=torch.int32)
135
+ slopes = torch.cat([slopes, torch.pow(extra_base, extra_powers)], dim=0)
136
+
137
+ # Note: alibi will added to the attention bias that will be applied to the query, key product of attention
138
+ # => therefore alibi will have to be of shape (batch_size, num_heads, query_length, key_length)
139
+ # => here we set (batch_size=1, num_heads=num_heads, query_length=1, key_length=max_length)
140
+ # => the query_length dimension will then be broadcasted correctly
141
+ # This is more or less identical to T5's relative position bias:
142
+ # https://github.com/huggingface/transformers/blob/f681437203baa7671de3174b0fa583c349d9d5e1/src/transformers/models/t5/modeling_t5.py#L527
143
+ arange_tensor = ((attention_mask.cumsum(dim=-1) - 1) * attention_mask)[:, None, :]
144
+ alibi = slopes[..., None].bfloat16() * arange_tensor
145
+ return alibi.reshape(batch_size * num_heads, 1, seq_length).to(dtype)
146
+
147
+
148
+ def dropout_add(x: torch.Tensor, residual: torch.Tensor, prob: float, training: bool) -> torch.Tensor:
149
+ out = F.dropout(x, p=prob, training=training)
150
+ out = residual + out
151
+ return out
152
+
153
+
154
+ class Attention(nn.Module):
155
+ def __init__(self, config: RWConfig):
156
+ super().__init__()
157
+
158
+ self.hidden_size = config.hidden_size
159
+ self.num_heads = config.n_head
160
+ self.head_dim = self.hidden_size // self.num_heads
161
+ self.split_size = self.hidden_size
162
+ self.hidden_dropout = config.hidden_dropout
163
+
164
+ if self.head_dim * self.num_heads != self.hidden_size:
165
+ raise ValueError(
166
+ f"`hidden_size` must be divisible by num_heads (got `hidden_size`: {self.hidden_size} and `num_heads`:"
167
+ f" {self.num_heads})."
168
+ )
169
+
170
+ self.maybe_rotary = RotaryEmbedding(config.head_dim) if config.rotary else lambda q, k: (q, k)
171
+
172
+ # Layer-wise attention scaling
173
+ self.inv_norm_factor = 1.0 / math.sqrt(self.head_dim)
174
+ self.beta = self.inv_norm_factor
175
+
176
+ self.query_key_value = Linear(
177
+ self.hidden_size,
178
+ 3 * self.hidden_size if not config.multi_query else (self.hidden_size + 2 * self.head_dim),
179
+ bias=config.bias,
180
+ )
181
+ self.multi_query = config.multi_query
182
+ self.dense = Linear(self.hidden_size, self.hidden_size, bias=config.bias)
183
+ self.attention_dropout = nn.Dropout(config.attention_dropout)
184
+ self.num_kv = config.n_head if not self.multi_query else 1
185
+
186
+ def _split_heads(self, fused_qkv: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
187
+ """
188
+ Split the last dimension into (num_heads, head_dim) without making any copies, results share same memory
189
+ storage as `fused_qkv`
190
+
191
+ Args:
192
+ fused_qkv (`torch.tensor`, *required*): [batch_size, seq_length, num_heads * 3 * head_dim]
193
+
194
+ Returns:
195
+ query: [batch_size, seq_length, num_heads, head_dim] key: [batch_size, seq_length, num_heads, head_dim]
196
+ value: [batch_size, seq_length, num_heads, head_dim]
197
+ """
198
+ if not self.multi_query:
199
+ batch_size, seq_length, three_times_hidden_size = fused_qkv.shape
200
+ fused_qkv = fused_qkv.view(batch_size, seq_length, self.num_heads, 3, self.head_dim)
201
+ return fused_qkv[..., 0, :], fused_qkv[..., 1, :], fused_qkv[..., 2, :]
202
+ else:
203
+ batch_size, seq_length, three_times_hidden_size = fused_qkv.shape
204
+ fused_qkv = fused_qkv.view(batch_size, seq_length, self.num_heads + 2, self.head_dim)
205
+ return fused_qkv[..., :-2, :], fused_qkv[..., [-2], :], fused_qkv[..., [-1], :]
206
+
207
+ def _merge_heads(self, x: torch.Tensor) -> torch.Tensor:
208
+ """
209
+ Merge heads together over the last dimenstion
210
+
211
+ Args:
212
+ x: (`torch.tensor`, *required*): [batch_size * num_heads, seq_length, head_dim]
213
+
214
+ Returns:
215
+ torch.tensor: [batch_size, seq_length, num_heads * head_dim]
216
+ """
217
+ # What we want to achieve is:
218
+ # batch_size * num_heads, seq_length, head_dim -> batch_size, seq_length, num_heads * head_dim
219
+ batch_size_and_num_heads, seq_length, _ = x.shape
220
+ batch_size = batch_size_and_num_heads // self.num_heads
221
+
222
+ # First view to decompose the batch size
223
+ # batch_size * num_heads, seq_length, head_dim -> batch_size, num_heads, seq_length, head_dim
224
+ x = x.view(batch_size, self.num_heads, seq_length, self.head_dim)
225
+
226
+ # batch_size, num_heads, seq_length, head_dim -> batch_size, seq_length, num_heads, head_dim
227
+ x = x.permute(0, 2, 1, 3)
228
+
229
+ # batch_size, seq_length, num_heads, head_dim -> batch_size, seq_length, num_heads * head_dim
230
+ return x.reshape(batch_size, seq_length, self.num_heads * self.head_dim)
231
+
232
+ def forward(
233
+ self,
234
+ hidden_states: torch.Tensor,
235
+ alibi: torch.Tensor,
236
+ attention_mask: torch.Tensor,
237
+ layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
238
+ head_mask: Optional[torch.Tensor] = None,
239
+ use_cache: bool = False,
240
+ output_attentions: bool = False,
241
+ ):
242
+ fused_qkv = self.query_key_value(hidden_states) # [batch_size, seq_length, 3 x hidden_size]
243
+
244
+ # 3 x [batch_size, seq_length, num_heads, head_dim]
245
+ (query_layer, key_layer, value_layer) = self._split_heads(fused_qkv)
246
+
247
+ batch_size, q_length, _, _ = query_layer.shape
248
+
249
+ query_layer = query_layer.transpose(1, 2).reshape(batch_size * self.num_heads, q_length, self.head_dim)
250
+ key_layer = key_layer.transpose(1, 2).reshape(
251
+ batch_size * self.num_kv,
252
+ q_length,
253
+ self.head_dim,
254
+ )
255
+ value_layer = value_layer.transpose(1, 2).reshape(batch_size * self.num_kv, q_length, self.head_dim)
256
+
257
+ query_layer, key_layer = self.maybe_rotary(query_layer, key_layer)
258
+
259
+ if layer_past is not None:
260
+ past_key, past_value = layer_past
261
+ # concatenate along seq_length dimension:
262
+ # - key: [batch_size * self.num_heads, head_dim, kv_length]
263
+ # - value: [batch_size * self.num_heads, kv_length, head_dim]
264
+ key_layer = torch.cat((past_key, key_layer), dim=1)
265
+ value_layer = torch.cat((past_value, value_layer), dim=1)
266
+
267
+ _, kv_length, _ = key_layer.shape
268
+
269
+ if use_cache is True:
270
+ present = (key_layer, value_layer)
271
+ else:
272
+ present = None
273
+
274
+ if alibi is None:
275
+ query_layer_ = query_layer.reshape(batch_size, self.num_heads, -1, self.head_dim)
276
+ key_layer_ = key_layer.reshape(batch_size, self.num_kv, -1, self.head_dim)
277
+ value_layer_ = value_layer.reshape(batch_size, self.num_kv, -1, self.head_dim)
278
+
279
+ attn_output = F.scaled_dot_product_attention(
280
+ query_layer_, key_layer_, value_layer_, None, 0.0, is_causal=True
281
+ )
282
+
283
+ x = attn_output.view(batch_size, self.num_heads, q_length, self.head_dim)
284
+ x = x.permute(0, 2, 1, 3)
285
+ attn_output = x.reshape(batch_size, q_length, self.num_heads * self.head_dim)
286
+
287
+ output_tensor = self.dense(attn_output)
288
+
289
+ outputs = (output_tensor, present)
290
+ assert not output_attentions # not supported.
291
+ return outputs
292
+ else:
293
+ attention_mask_float = (attention_mask * 1.0).masked_fill(attention_mask, -1e9).to(torch.bfloat16)
294
+ matmul_result = query_layer @ key_layer.transpose(-1, -2)
295
+
296
+ # change view to [batch_size, num_heads, q_length, kv_length]
297
+ attention_scores = matmul_result.view(batch_size, self.num_heads, q_length, kv_length)
298
+
299
+ # cast attention scores to fp32, compute scaled softmax and cast back to initial dtype - [batch_size, num_heads, q_length, kv_length]
300
+ input_dtype = attention_scores.dtype
301
+ # `float16` has a minimum value of -65504.0, whereas `bfloat16` and `float32` have a minimum value of `-3.4e+38`
302
+ if input_dtype == torch.float16 or input_dtype == torch.bfloat16:
303
+ attention_scores = attention_scores.to(torch.float32)
304
+ # attn_weights = torch.masked_fill(attention_scores, attention_mask, torch.finfo(attention_scores.dtype).min)
305
+ attention_probs = F.softmax(
306
+ (attention_scores + alibi.view(batch_size, self.num_heads, 1, -1)) * self.inv_norm_factor + attention_mask_float,
307
+ dim=-1,
308
+ dtype=hidden_states.dtype,
309
+ )
310
+ # [batch_size, num_heads, q_length, kv_length]
311
+ attention_probs = self.attention_dropout(attention_probs)
312
+
313
+ if head_mask is not None:
314
+ attention_probs = attention_probs * head_mask
315
+
316
+ # change view [batch_size x num_heads, q_length, kv_length]
317
+ attention_probs_reshaped = attention_probs.view(batch_size * self.num_heads, q_length, kv_length)
318
+
319
+ # matmul: [batch_size * num_heads, q_length, head_dim]
320
+ context_layer = attention_probs_reshaped @ value_layer
321
+
322
+ # change view [batch_size, num_heads, q_length, head_dim]
323
+ context_layer = self._merge_heads(context_layer)
324
+
325
+ output_tensor = self.dense(context_layer)
326
+
327
+ outputs = (output_tensor, present)
328
+ if output_attentions:
329
+ outputs += (attention_probs,)
330
+
331
+ return outputs
332
+
333
+
334
+ class MLP(nn.Module):
335
+ def __init__(self, config: RWConfig):
336
+ super().__init__()
337
+ hidden_size = config.hidden_size
338
+
339
+ self.dense_h_to_4h = Linear(hidden_size, 4 * hidden_size, bias=config.bias)
340
+ self.act = nn.GELU()
341
+ self.dense_4h_to_h = Linear(4 * hidden_size, hidden_size, bias=config.bias)
342
+ self.hidden_dropout = config.hidden_dropout
343
+
344
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
345
+ x = self.act(self.dense_h_to_4h(x))
346
+ x = self.dense_4h_to_h(x)
347
+ return x
348
+
349
+
350
+ class DecoderLayer(nn.Module):
351
+ def __init__(self, config: RWConfig):
352
+ super().__init__()
353
+ hidden_size = config.hidden_size
354
+
355
+ self.input_layernorm = LayerNorm(hidden_size, eps=config.layer_norm_epsilon)
356
+ self.num_heads = config.n_head
357
+ self.self_attention = Attention(config)
358
+
359
+ if not config.parallel_attn:
360
+ # unused if parallel attn
361
+ self.post_attention_layernorm = LayerNorm(hidden_size, eps=config.layer_norm_epsilon)
362
+
363
+ self.mlp = MLP(config)
364
+
365
+ self.apply_residual_connection_post_layernorm = config.apply_residual_connection_post_layernorm
366
+ self.hidden_dropout = config.hidden_dropout
367
+
368
+ self.config = config
369
+
370
+ def forward(
371
+ self,
372
+ hidden_states: torch.Tensor,
373
+ alibi: torch.Tensor,
374
+ attention_mask: torch.Tensor,
375
+ layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
376
+ head_mask: Optional[torch.Tensor] = None,
377
+ use_cache: bool = False,
378
+ output_attentions: bool = False,
379
+ ):
380
+
381
+ layernorm_output = self.input_layernorm(hidden_states)
382
+ residual = hidden_states
383
+
384
+ # Self attention.
385
+ attn_outputs = self.self_attention(
386
+ layernorm_output,
387
+ layer_past=layer_past,
388
+ attention_mask=attention_mask,
389
+ alibi=alibi,
390
+ head_mask=head_mask,
391
+ use_cache=use_cache,
392
+ output_attentions=output_attentions,
393
+ )
394
+
395
+ attention_output = attn_outputs[0]
396
+
397
+ if not self.config.parallel_attn:
398
+ residual = dropout_add(attention_output, residual, self.config.attention_dropout, training=self.training)
399
+ layernorm_output = self.post_attention_layernorm(residual)
400
+
401
+ outputs = attn_outputs[1:]
402
+
403
+ # MLP.
404
+ mlp_output = self.mlp(layernorm_output)
405
+
406
+ if self.config.parallel_attn:
407
+ mlp_output += attention_output
408
+
409
+ output = dropout_add(mlp_output, residual, self.config.hidden_dropout, training=self.training)
410
+
411
+ if use_cache:
412
+ outputs = (output,) + outputs
413
+ else:
414
+ outputs = (output,) + outputs[1:]
415
+
416
+ return outputs # hidden_states, present, attentions
417
+
418
+
419
+ class RWPreTrainedModel(PreTrainedModel):
420
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
421
+ """
422
+ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
423
+ models.
424
+ """
425
+
426
+ config_class = RWConfig
427
+ base_model_prefix = "transformer"
428
+ supports_gradient_checkpointing = True
429
+ _no_split_modules = ["DecoderLayer"]
430
+
431
+ def __init__(self, *inputs, **kwargs):
432
+ super().__init__(*inputs, **kwargs)
433
+
434
+ def _init_weights(self, module: nn.Module):
435
+ """Initialize the weights."""
436
+ if isinstance(module, nn.Linear) or isinstance(module, Linear):
437
+ # Slightly different from the TF version which uses truncated_normal for initialization
438
+ # cf https://github.com/pytorch/pytorch/pull/5617
439
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
440
+ if module.bias is not None:
441
+ module.bias.data.zero_()
442
+ elif isinstance(module, nn.Embedding):
443
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
444
+ if module.padding_idx is not None:
445
+ module.weight.data[module.padding_idx].zero_()
446
+ elif isinstance(module, LayerNorm):
447
+ module.bias.data.zero_()
448
+ module.weight.data.fill_(1.0)
449
+
450
+ def _set_gradient_checkpointing(self, module: nn.Module, value: bool = False):
451
+ if isinstance(module, RWModel):
452
+ module.gradient_checkpointing = value
453
+
454
+ @staticmethod
455
+ def _convert_to_standard_cache(
456
+ past_key_value: Tuple[Tuple[torch.Tensor, torch.Tensor]], batch_size: int
457
+ ) -> Tuple[Tuple[torch.Tensor, torch.Tensor]]:
458
+ """
459
+ Standardizes the format of the cache so as to match most implementations, i.e. to tuple(tuple([batch_size,
460
+ num_heads, ...]))
461
+ """
462
+ batch_size_times_num_heads, head_dim, seq_length = past_key_value[0][0].shape
463
+ num_heads = batch_size_times_num_heads // batch_size
464
+ # key: [batch_size * num_heads, head_dim, seq_length] -> [batch_size, num_heads, head_dim, seq_length]
465
+ # value: [batch_size * num_heads, seq_length, head_dim] -> [batch_size, num_heads, seq_length, head_dim]
466
+ return tuple(
467
+ (
468
+ layer_past[0].view(batch_size, num_heads, head_dim, seq_length),
469
+ layer_past[1].view(batch_size, num_heads, seq_length, head_dim),
470
+ )
471
+ for layer_past in past_key_value
472
+ )
473
+
474
+ @staticmethod
475
+ def _convert_to_rw_cache(
476
+ past_key_value: Tuple[Tuple[torch.Tensor, torch.Tensor]]
477
+ ) -> Tuple[Tuple[torch.Tensor, torch.Tensor]]:
478
+ batch_size, num_heads, head_dim, seq_length = past_key_value[0][0].shape
479
+ batch_size_times_num_heads = batch_size * num_heads
480
+ # key: [batch_size, num_heads, head_dim, seq_length] -> [batch_size * num_heads, head_dim, seq_length]
481
+ # value: [batch_size, num_heads, seq_length, head_dim] -> [batch_size * num_heads, seq_length, head_dim]
482
+ return tuple(
483
+ (
484
+ layer_past[0].view(batch_size_times_num_heads, head_dim, seq_length),
485
+ layer_past[1].view(batch_size_times_num_heads, seq_length, head_dim),
486
+ )
487
+ for layer_past in past_key_value
488
+ )
489
+
490
+
491
+ class RWModel(RWPreTrainedModel):
492
+ def __init__(self, config: RWConfig):
493
+ super().__init__(config)
494
+
495
+ self.embed_dim = config.hidden_size
496
+ self.num_heads = config.n_head
497
+ self.alibi = config.alibi
498
+
499
+ # Embedding + LN Embedding
500
+ self.word_embeddings = nn.Embedding(config.vocab_size, self.embed_dim)
501
+
502
+ # Transformer blocks
503
+ self.h = nn.ModuleList([DecoderLayer(config) for _ in range(config.num_hidden_layers)])
504
+
505
+ # Final Layer Norm
506
+ self.ln_f = LayerNorm(self.embed_dim, eps=config.layer_norm_epsilon)
507
+
508
+ self.gradient_checkpointing = False
509
+
510
+ # Initialize weights and apply final processing
511
+ self.post_init()
512
+
513
+ def get_input_embeddings(self):
514
+ return self.word_embeddings
515
+
516
+ def _prepare_attn_mask(
517
+ self, attention_mask: torch.Tensor, input_shape: Tuple[int, int], past_key_values_length: int
518
+ ) -> torch.BoolTensor:
519
+ # create causal mask
520
+ # [batch_size, seq_length] -> [batch_size, 1, tgt_length, src_length]
521
+ combined_attention_mask = None
522
+ device = attention_mask.device
523
+ _, src_length = input_shape
524
+
525
+ if src_length > 1:
526
+ combined_attention_mask = _make_causal_mask(
527
+ input_shape, device=device, past_key_values_length=past_key_values_length
528
+ )
529
+
530
+ # [batch_size, seq_length] -> [batch_size, 1, tgt_length, src_length]
531
+ expanded_attn_mask = _expand_mask(attention_mask, tgt_length=src_length)
532
+ combined_attention_mask = (
533
+ expanded_attn_mask if combined_attention_mask is None else expanded_attn_mask | combined_attention_mask
534
+ )
535
+
536
+ return combined_attention_mask
537
+
538
+ def set_input_embeddings(self, new_embeddings: torch.Tensor):
539
+ self.word_embeddings = new_embeddings
540
+
541
+ def forward(
542
+ self,
543
+ input_ids: Optional[torch.LongTensor] = None,
544
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
545
+ attention_mask: Optional[torch.Tensor] = None,
546
+ head_mask: Optional[torch.LongTensor] = None,
547
+ inputs_embeds: Optional[torch.LongTensor] = None,
548
+ use_cache: Optional[bool] = None,
549
+ output_attentions: Optional[bool] = None,
550
+ output_hidden_states: Optional[bool] = None,
551
+ return_dict: Optional[bool] = None,
552
+ **deprecated_arguments,
553
+ ) -> Union[Tuple[torch.Tensor, ...], BaseModelOutputWithPastAndCrossAttentions]:
554
+ if deprecated_arguments.pop("position_ids", False) is not False:
555
+ # `position_ids` could have been `torch.Tensor` or `None` so defaulting pop to `False` allows to detect if users were passing explicitly `None`
556
+ warnings.warn(
557
+ "`position_ids` have no functionality in BLOOM and will be removed in v5.0.0. You can safely ignore"
558
+ " passing `position_ids`.",
559
+ FutureWarning,
560
+ )
561
+ if len(deprecated_arguments) > 0:
562
+ raise ValueError(f"Got unexpected arguments: {deprecated_arguments}")
563
+
564
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
565
+ output_hidden_states = (
566
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
567
+ )
568
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
569
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
570
+
571
+ if input_ids is not None and inputs_embeds is not None:
572
+ raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
573
+ elif input_ids is not None:
574
+ batch_size, seq_length = input_ids.shape
575
+ elif inputs_embeds is not None:
576
+ batch_size, seq_length, _ = inputs_embeds.shape
577
+ else:
578
+ raise ValueError("You have to specify either input_ids or inputs_embeds")
579
+
580
+ if past_key_values is None:
581
+ past_key_values = tuple([None] * len(self.h))
582
+
583
+ # Prepare head mask if needed
584
+ # 1.0 in head_mask indicate we keep the head
585
+ # attention_probs has shape batch_size x num_heads x N x N
586
+ # head_mask has shape n_layer x batch x num_heads x N x N
587
+ head_mask = self.get_head_mask(head_mask, self.config.n_layer)
588
+
589
+ if inputs_embeds is None:
590
+ inputs_embeds = self.word_embeddings(input_ids)
591
+
592
+ hidden_states = inputs_embeds
593
+
594
+ presents = () if use_cache else None
595
+ all_self_attentions = () if output_attentions else None
596
+ all_hidden_states = () if output_hidden_states else None
597
+
598
+ # Compute alibi tensor: check build_alibi_tensor documentation
599
+ seq_length_with_past = seq_length
600
+ past_key_values_length = 0
601
+ if past_key_values[0] is not None:
602
+ past_key_values_length = past_key_values[0][0].shape[2]
603
+ seq_length_with_past = seq_length_with_past + past_key_values_length
604
+ if attention_mask is None:
605
+ attention_mask = torch.ones((batch_size, seq_length_with_past), device=hidden_states.device)
606
+ else:
607
+ attention_mask = attention_mask.to(hidden_states.device)
608
+
609
+ if self.alibi:
610
+ alibi = build_alibi_tensor(attention_mask, self.num_heads, dtype=hidden_states.dtype)
611
+ else:
612
+ alibi = None
613
+
614
+ causal_mask = self._prepare_attn_mask(
615
+ attention_mask,
616
+ input_shape=(batch_size, seq_length),
617
+ past_key_values_length=past_key_values_length,
618
+ )
619
+
620
+ for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
621
+
622
+ if output_hidden_states:
623
+ all_hidden_states = all_hidden_states + (hidden_states,)
624
+
625
+ if self.gradient_checkpointing and self.training:
626
+
627
+ if use_cache:
628
+ logger.warning(
629
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
630
+ )
631
+ use_cache = False
632
+
633
+ def create_custom_forward(module):
634
+ def custom_forward(*inputs):
635
+ # None for past_key_value
636
+ return module(*inputs, use_cache=use_cache, output_attentions=output_attentions)
637
+
638
+ return custom_forward
639
+
640
+ outputs = torch.utils.checkpoint.checkpoint(
641
+ create_custom_forward(block),
642
+ hidden_states,
643
+ alibi,
644
+ causal_mask,
645
+ head_mask[i],
646
+ )
647
+ else:
648
+ outputs = block(
649
+ hidden_states,
650
+ layer_past=layer_past,
651
+ attention_mask=causal_mask,
652
+ head_mask=head_mask[i],
653
+ use_cache=use_cache,
654
+ output_attentions=output_attentions,
655
+ alibi=alibi,
656
+ )
657
+
658
+ hidden_states = outputs[0]
659
+ if use_cache is True:
660
+ presents = presents + (outputs[1],)
661
+
662
+ if output_attentions:
663
+ all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
664
+
665
+ # Add last hidden state
666
+ hidden_states = self.ln_f(hidden_states)
667
+
668
+ if output_hidden_states:
669
+ all_hidden_states = all_hidden_states + (hidden_states,)
670
+
671
+ if not return_dict:
672
+ return tuple(v for v in [hidden_states, presents, all_hidden_states, all_self_attentions] if v is not None)
673
+
674
+ return BaseModelOutputWithPastAndCrossAttentions(
675
+ last_hidden_state=hidden_states,
676
+ past_key_values=presents,
677
+ hidden_states=all_hidden_states,
678
+ attentions=all_self_attentions,
679
+ )
680
+
681
+
682
+ class RWForCausalLM(RWPreTrainedModel):
683
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
684
+
685
+ def __init__(self, config: RWConfig):
686
+ super().__init__(config)
687
+ self.transformer = RWModel(config)
688
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
689
+
690
+ # Initialize weights and apply final processing
691
+ self.post_init()
692
+
693
+ def get_output_embeddings(self):
694
+ return self.lm_head
695
+
696
+ def set_output_embeddings(self, new_embeddings: torch.Tensor):
697
+ self.lm_head = new_embeddings
698
+
699
+ def prepare_inputs_for_generation(
700
+ self,
701
+ input_ids: torch.LongTensor,
702
+ past: Optional[torch.Tensor] = None,
703
+ attention_mask: Optional[torch.Tensor] = None,
704
+ **kwargs,
705
+ ) -> dict:
706
+ # only last token for input_ids if past is not None
707
+ if past:
708
+ input_ids = input_ids[:, -1].unsqueeze(-1)
709
+
710
+ # the cache may be in the stardard format (e.g. in contrastive search), convert to our's format if needed
711
+ if past[0][0].shape[0] == input_ids.shape[0]:
712
+ past = self._convert_to_rw_cache(past)
713
+
714
+ return {
715
+ "input_ids": input_ids,
716
+ "past_key_values": past,
717
+ "use_cache": kwargs.get("use_cache"),
718
+ "attention_mask": attention_mask,
719
+ }
720
+
721
+ def forward(
722
+ self,
723
+ input_ids: Optional[torch.LongTensor] = None,
724
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
725
+ attention_mask: Optional[torch.Tensor] = None,
726
+ head_mask: Optional[torch.Tensor] = None,
727
+ inputs_embeds: Optional[torch.Tensor] = None,
728
+ labels: Optional[torch.Tensor] = None,
729
+ use_cache: Optional[bool] = None,
730
+ output_attentions: Optional[bool] = None,
731
+ output_hidden_states: Optional[bool] = None,
732
+ return_dict: Optional[bool] = None,
733
+ **deprecated_arguments,
734
+ ) -> Union[Tuple[torch.Tensor], CausalLMOutputWithCrossAttentions]:
735
+ r"""
736
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
737
+ Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
738
+ `labels = input_ids` Indices are selected in `[-100, 0, ..., config.vocab_size]` All labels set to `-100`
739
+ are ignored (masked), the loss is only computed for labels in `[0, ..., config.vocab_size]`
740
+ """
741
+ if deprecated_arguments.pop("position_ids", False) is not False:
742
+ # `position_ids` could have been `torch.Tensor` or `None` so defaulting pop to `False` allows to detect if users were passing explicitly `None`
743
+ warnings.warn(
744
+ "`position_ids` have no functionality in BLOOM and will be removed in v5.0.0. You can safely ignore"
745
+ " passing `position_ids`.",
746
+ FutureWarning,
747
+ )
748
+ if len(deprecated_arguments) > 0:
749
+ raise ValueError(f"Got unexpected arguments: {deprecated_arguments}")
750
+
751
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
752
+
753
+ transformer_outputs = self.transformer(
754
+ input_ids,
755
+ past_key_values=past_key_values,
756
+ attention_mask=attention_mask,
757
+ head_mask=head_mask,
758
+ inputs_embeds=inputs_embeds,
759
+ use_cache=use_cache,
760
+ output_attentions=output_attentions,
761
+ output_hidden_states=output_hidden_states,
762
+ return_dict=return_dict,
763
+ )
764
+ hidden_states = transformer_outputs[0]
765
+
766
+ lm_logits = self.lm_head(hidden_states)
767
+
768
+ loss = None
769
+ if labels is not None:
770
+ # Shift so that tokens < n predict n
771
+ shift_logits = lm_logits[..., :-1, :].contiguous()
772
+ shift_labels = labels[..., 1:].contiguous()
773
+ batch_size, seq_length, vocab_size = shift_logits.shape
774
+ # Flatten the tokens
775
+ loss_fct = CrossEntropyLoss()
776
+ loss = loss_fct(
777
+ shift_logits.view(batch_size * seq_length, vocab_size), shift_labels.view(batch_size * seq_length)
778
+ )
779
+
780
+ if not return_dict:
781
+ output = (lm_logits,) + transformer_outputs[1:]
782
+ return ((loss,) + output) if loss is not None else output
783
+
784
+ return CausalLMOutputWithCrossAttentions(
785
+ loss=loss,
786
+ logits=lm_logits,
787
+ past_key_values=transformer_outputs.past_key_values,
788
+ hidden_states=transformer_outputs.hidden_states,
789
+ attentions=transformer_outputs.attentions,
790
+ )
791
+
792
+ def _reorder_cache(
793
+ self, past: Tuple[Tuple[torch.Tensor, torch.Tensor], ...], beam_idx: torch.LongTensor
794
+ ) -> Tuple[Tuple[torch.Tensor, torch.Tensor], ...]:
795
+ """
796
+ This function is used to re-order the `past_key_values` cache if [`~PreTrainedModel.beam_search`] or
797
+ [`~PreTrainedModel.beam_sample`] is called. This is required to match `past_key_values` with the correct
798
+ beam_idx at every generation step.
799
+
800
+ Output shares the same memory storage as `past`.
801
+ """
802
+ standardized_past = self._convert_to_standard_cache(past, batch_size=len(beam_idx))
803
+
804
+ # Get a copy of `beam_idx` on all the devices where we need those indices.
805
+ device_to_beam_idx = {
806
+ past_state.device: beam_idx.to(past_state.device) for layer_past in past for past_state in layer_past
807
+ }
808
+ reordered_past = tuple(
809
+ (
810
+ layer_past[0].index_select(0, device_to_beam_idx[layer_past[0].device]),
811
+ layer_past[1].index_select(0, device_to_beam_idx[layer_past[0].device]),
812
+ )
813
+ for layer_past in standardized_past
814
+ )
815
+ return self._convert_to_rw_cache(reordered_past)
816
+
817
+
818
+ class RWForSequenceClassification(RWPreTrainedModel):
819
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
820
+
821
+ def __init__(self, config: RWConfig):
822
+ super().__init__(config)
823
+ self.num_labels = config.num_labels
824
+ self.transformer = RWModel(config)
825
+ self.score = nn.Linear(config.hidden_size, config.num_labels, bias=False)
826
+
827
+ # Initialize weights and apply final processing
828
+ self.post_init()
829
+
830
+ def forward(
831
+ self,
832
+ input_ids: Optional[torch.LongTensor] = None,
833
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
834
+ attention_mask: Optional[torch.Tensor] = None,
835
+ head_mask: Optional[torch.Tensor] = None,
836
+ inputs_embeds: Optional[torch.Tensor] = None,
837
+ labels: Optional[torch.Tensor] = None,
838
+ use_cache: Optional[bool] = None,
839
+ output_attentions: Optional[bool] = None,
840
+ output_hidden_states: Optional[bool] = None,
841
+ return_dict: Optional[bool] = None,
842
+ **deprecated_arguments,
843
+ ) -> Union[Tuple[torch.Tensor], SequenceClassifierOutputWithPast]:
844
+ r"""
845
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
846
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
847
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
848
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
849
+ """
850
+ if deprecated_arguments.pop("position_ids", False) is not False:
851
+ # `position_ids` could have been `torch.Tensor` or `None` so defaulting pop to `False` allows to detect if users were passing explicitly `None`
852
+ warnings.warn(
853
+ "`position_ids` have no functionality in BLOOM and will be removed in v5.0.0. You can safely ignore"
854
+ " passing `position_ids`.",
855
+ FutureWarning,
856
+ )
857
+ if len(deprecated_arguments) > 0:
858
+ raise ValueError(f"Got unexpected arguments: {deprecated_arguments}")
859
+
860
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
861
+
862
+ transformer_outputs = self.transformer(
863
+ input_ids,
864
+ past_key_values=past_key_values,
865
+ attention_mask=attention_mask,
866
+ head_mask=head_mask,
867
+ inputs_embeds=inputs_embeds,
868
+ use_cache=use_cache,
869
+ output_attentions=output_attentions,
870
+ output_hidden_states=output_hidden_states,
871
+ return_dict=return_dict,
872
+ )
873
+
874
+ hidden_states = transformer_outputs[0]
875
+ logits = self.score(hidden_states)
876
+
877
+ if input_ids is not None:
878
+ batch_size = input_ids.shape[0]
879
+ else:
880
+ batch_size = inputs_embeds.shape[0]
881
+
882
+ if self.config.pad_token_id is None and batch_size != 1:
883
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
884
+ if self.config.pad_token_id is None:
885
+ sequence_lengths = -1
886
+ else:
887
+ if input_ids is not None:
888
+ sequence_lengths = torch.ne(input_ids, self.config.pad_token_id).sum(dim=-1) - 1
889
+ else:
890
+ sequence_lengths = -1
891
+ logger.warning(
892
+ f"{self.__class__.__name__} will not detect padding tokens in `inputs_embeds`. Results may be "
893
+ "unexpected if using padding tokens in conjunction with `inputs_embeds.`"
894
+ )
895
+
896
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
897
+
898
+ loss = None
899
+ if labels is not None:
900
+ if self.config.problem_type is None:
901
+ if self.num_labels == 1:
902
+ self.config.problem_type = "regression"
903
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
904
+ self.config.problem_type = "single_label_classification"
905
+ else:
906
+ self.config.problem_type = "multi_label_classification"
907
+
908
+ if self.config.problem_type == "regression":
909
+ loss_fct = MSELoss()
910
+ if self.num_labels == 1:
911
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
912
+ else:
913
+ loss = loss_fct(pooled_logits, labels)
914
+ elif self.config.problem_type == "single_label_classification":
915
+ loss_fct = CrossEntropyLoss()
916
+ loss = loss_fct(pooled_logits, labels)
917
+ elif self.config.problem_type == "multi_label_classification":
918
+ loss_fct = BCEWithLogitsLoss()
919
+ loss = loss_fct(pooled_logits, labels)
920
+ if not return_dict:
921
+ output = (pooled_logits,) + transformer_outputs[1:]
922
+ return ((loss,) + output) if loss is not None else output
923
+
924
+ return SequenceClassifierOutputWithPast(
925
+ loss=loss,
926
+ logits=pooled_logits,
927
+ past_key_values=transformer_outputs.past_key_values,
928
+ hidden_states=transformer_outputs.hidden_states,
929
+ attentions=transformer_outputs.attentions,
930
+ )
931
+
932
+
933
+ class RWForTokenClassification(RWPreTrainedModel):
934
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
935
+
936
+ def __init__(self, config: RWConfig):
937
+ super().__init__(config)
938
+ self.num_labels = config.num_labels
939
+
940
+ self.transformer = RWModel(config)
941
+ if hasattr(config, "classifier_dropout") and config.classifier_dropout is not None:
942
+ classifier_dropout = config.classifier_dropout
943
+ elif hasattr(config, "hidden_dropout") and config.hidden_dropout is not None:
944
+ classifier_dropout = config.hidden_dropout
945
+ else:
946
+ classifier_dropout = 0.1
947
+ self.dropout = nn.Dropout(classifier_dropout)
948
+ self.classifier = nn.Linear(config.hidden_size, config.num_labels)
949
+
950
+ # Initialize weights and apply final processing
951
+ self.post_init()
952
+
953
+ def forward(
954
+ self,
955
+ input_ids: Optional[torch.LongTensor] = None,
956
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
957
+ attention_mask: Optional[torch.Tensor] = None,
958
+ head_mask: Optional[torch.Tensor] = None,
959
+ inputs_embeds: Optional[torch.Tensor] = None,
960
+ labels: Optional[torch.Tensor] = None,
961
+ use_cache: Optional[bool] = None,
962
+ output_attentions: Optional[bool] = None,
963
+ output_hidden_states: Optional[bool] = None,
964
+ return_dict: Optional[bool] = None,
965
+ **deprecated_arguments,
966
+ ) -> Union[Tuple[torch.Tensor], TokenClassifierOutput]:
967
+ r"""
968
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
969
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
970
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
971
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
972
+ """
973
+ if deprecated_arguments.pop("position_ids", False) is not False:
974
+ # `position_ids` could have been `torch.Tensor` or `None` so defaulting pop to `False` allows to detect if users were passing explicitly `None`
975
+ warnings.warn(
976
+ "`position_ids` have no functionality in BLOOM and will be removed in v5.0.0. You can safely ignore"
977
+ " passing `position_ids`.",
978
+ FutureWarning,
979
+ )
980
+ if len(deprecated_arguments) > 0:
981
+ raise ValueError(f"Got unexpected arguments: {deprecated_arguments}")
982
+
983
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
984
+
985
+ transformer_outputs = self.transformer(
986
+ input_ids,
987
+ past_key_values=past_key_values,
988
+ attention_mask=attention_mask,
989
+ head_mask=head_mask,
990
+ inputs_embeds=inputs_embeds,
991
+ use_cache=use_cache,
992
+ output_attentions=output_attentions,
993
+ output_hidden_states=output_hidden_states,
994
+ return_dict=return_dict,
995
+ )
996
+
997
+ hidden_states = transformer_outputs[0]
998
+ hidden_states = self.dropout(hidden_states)
999
+ logits = self.classifier(hidden_states)
1000
+
1001
+ loss = None
1002
+ if labels is not None:
1003
+ batch_size, seq_length = labels.shape
1004
+ loss_fct = CrossEntropyLoss()
1005
+ loss = loss_fct(logits.view(batch_size * seq_length, self.num_labels), labels.view(batch_size * seq_length))
1006
+
1007
+ if not return_dict:
1008
+ output = (logits,) + transformer_outputs[2:]
1009
+ return ((loss,) + output) if loss is not None else output
1010
+
1011
+ return TokenClassifierOutput(
1012
+ loss=loss,
1013
+ logits=logits,
1014
+ hidden_states=transformer_outputs.hidden_states,
1015
+ attentions=transformer_outputs.attentions,
1016
+ )
1017
+
1018
+
1019
+ class RWForQuestionAnswering(RWPreTrainedModel):
1020
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
1021
+
1022
+ def __init__(self, config):
1023
+ super().__init__(config)
1024
+ self.transformer = RWModel(config)
1025
+ self.qa_outputs = nn.Linear(config.hidden_size, 2)
1026
+
1027
+ # Initialize weights and apply final processing
1028
+ self.post_init()
1029
+
1030
+ def forward(
1031
+ self,
1032
+ input_ids: Optional[torch.LongTensor] = None,
1033
+ attention_mask: Optional[torch.FloatTensor] = None,
1034
+ position_ids: Optional[torch.LongTensor] = None,
1035
+ head_mask: Optional[torch.FloatTensor] = None,
1036
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1037
+ start_positions: Optional[torch.LongTensor] = None,
1038
+ end_positions: Optional[torch.LongTensor] = None,
1039
+ output_attentions: Optional[bool] = None,
1040
+ output_hidden_states: Optional[bool] = None,
1041
+ return_dict: Optional[bool] = None,
1042
+ ) -> Union[Tuple, QuestionAnsweringModelOutput]:
1043
+ r"""
1044
+ start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1045
+ Labels for position (index) of the start of the labelled span for computing the token classification loss.
1046
+ Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
1047
+ are not taken into account for computing the loss.
1048
+ end_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1049
+ Labels for position (index) of the end of the labelled span for computing the token classification loss.
1050
+ Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
1051
+ are not taken into account for computing the loss.
1052
+ """
1053
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1054
+
1055
+ outputs = self.transformer(
1056
+ input_ids,
1057
+ attention_mask=attention_mask,
1058
+ position_ids=position_ids,
1059
+ head_mask=head_mask,
1060
+ inputs_embeds=inputs_embeds,
1061
+ output_attentions=output_attentions,
1062
+ output_hidden_states=output_hidden_states,
1063
+ return_dict=return_dict,
1064
+ )
1065
+
1066
+ sequence_output = outputs[0]
1067
+
1068
+ logits = self.qa_outputs(sequence_output)
1069
+ start_logits, end_logits = logits.split(1, dim=-1)
1070
+ start_logits = start_logits.squeeze(-1).contiguous()
1071
+ end_logits = end_logits.squeeze(-1).contiguous()
1072
+
1073
+ total_loss = None
1074
+ if start_positions is not None and end_positions is not None:
1075
+ # If we are on multi-GPU, split add a dimension
1076
+ if len(start_positions.size()) > 1:
1077
+ start_positions = start_positions.squeeze(-1)
1078
+ if len(end_positions.size()) > 1:
1079
+ end_positions = end_positions.squeeze(-1)
1080
+ # sometimes the start/end positions are outside our model inputs, we ignore these terms
1081
+ ignored_index = start_logits.size(1)
1082
+ start_positions = start_positions.clamp(0, ignored_index)
1083
+ end_positions = end_positions.clamp(0, ignored_index)
1084
+
1085
+ loss_fct = CrossEntropyLoss(ignore_index=ignored_index)
1086
+ start_loss = loss_fct(start_logits, start_positions)
1087
+ end_loss = loss_fct(end_logits, end_positions)
1088
+ total_loss = (start_loss + end_loss) / 2
1089
+
1090
+ if not return_dict:
1091
+ output = (start_logits, end_logits) + outputs[2:]
1092
+ return ((total_loss,) + output) if total_loss is not None else output
1093
+
1094
+ return QuestionAnsweringModelOutput(
1095
+ loss=total_loss,
1096
+ start_logits=start_logits,
1097
+ end_logits=end_logits,
1098
+ hidden_states=outputs.hidden_states,
1099
+ attentions=outputs.attentions,
1100
+ )
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc6957902d07d7a210613c1caa9f18f809699ee4cd0c31de0de5be119efeee39
3
+ size 13709266611
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|endoftext|>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|endoftext|>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "<|endoftext|>",
17
+ "unk_token": {
18
+ "content": "<|endoftext|>",
19
+ "lstrip": false,
20
+ "normalized": true,
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_config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "clean_up_tokenization_spaces": true,
13
+ "eos_token": {
14
+ "__type": "AddedToken",
15
+ "content": "<|endoftext|>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "errors": "replace",
22
+ "model_max_length": 2048,
23
+ "pad_token": null,
24
+ "tokenizer_class": "GPT2Tokenizer",
25
+ "unk_token": {
26
+ "__type": "AddedToken",
27
+ "content": "<|endoftext|>",
28
+ "lstrip": false,
29
+ "normalized": true,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ }
33
+ }
train_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 1.0,
3
+ "train_loss": 0.2576859601399347,
4
+ "train_runtime": 150388.7494,
5
+ "train_samples": 26705019,
6
+ "train_samples_per_second": 177.573,
7
+ "train_steps_per_second": 22.197
8
+ }
trainer_state.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:3e3730b770a7a69a97a94adeeead1c692defea9bd7b7bf89372f99be11a0b762
3
+ size 4987
vocab.json ADDED
The diff for this file is too large to render. See raw diff