thorunna commited on
Commit
eb7040d
1 Parent(s): ac9c7dd

All relevant files added

Browse files
example_inputs/task1_example.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ þeta er texi inniheldur möuelga villur.
2
+ Kversu vel ganga leiretta þenna texta
example_inputs/task2_example.jsonl ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ {"a": "Þetta er texti sem inniheldur mögulega einhverjar villur.", "b": "þeta er texi inniheldur möuelga villur."}
2
+ {"a": "Kversu vel ganga velja mili þessarra texta", "b": "Hversu vel ætli gangi að velja milli þessara texta?"}
example_inputs/task3_example.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ þeta er texi inniheldur möuelga villur.
2
+ Kversu vel ganga leiretta þenna texta
example_outputs/task1_example.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ þeta er texi inniheldur möuelga villur.
2
+ - 'þeta' á undan 'er' væri betur ritað sem 'Þetta'.
3
+ - 'texi' beint á eftir 'er' og á undan 'inniheldur' væri betur ritað sem 'texti'.
4
+ - 'möuelga' beint á eftir 'inniheldur' og á undan 'villur' væri betur ritað sem 'mögulega'.
5
+
6
+ Kversu vel ganga leiretta þenna texta
7
+ - 'leiretta' beint á eftir 'gegna' og á undan 'þenna' væri betur ritað sem 'leirrétta'.
8
+
example_outputs/task2_example.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ B
2
+ B
example_outputs/task3_example.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Þetta er texti sem inniheldur mögulega villur.
2
+ Kversu vel gengur að þýða þennan texta.
gpt-sw3-model/config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/p/scratch/trustllm/ingvarssonjuto1/GPT-SW3/checkpoints_run_6/unwrapped_step_8192",
3
+ "activation_function": "gelu",
4
+ "apply_query_key_layer_scaling": true,
5
+ "architectures": [
6
+ "GPT2LMHeadModel"
7
+ ],
8
+ "attn_pdrop": 0.1,
9
+ "bos_token_id": 1,
10
+ "embd_pdrop": 0.1,
11
+ "eos_token_id": 1,
12
+ "initializer_range": 0.01,
13
+ "layer_norm_epsilon": 1e-05,
14
+ "model_type": "gpt2",
15
+ "n_ctx": 2048,
16
+ "n_embd": 4096,
17
+ "n_head": 32,
18
+ "n_inner": 16384,
19
+ "n_layer": 32,
20
+ "n_positions": 2048,
21
+ "normalize_attention_scores": true,
22
+ "pad_token_id": 0,
23
+ "reorder_and_upcast_attn": false,
24
+ "resid_pdrop": 0.1,
25
+ "scale_attn_by_inverse_layer_idx": false,
26
+ "scale_attn_weights": true,
27
+ "summary_activation": null,
28
+ "summary_first_dropout": 0.1,
29
+ "summary_proj_to_labels": true,
30
+ "summary_type": "cls_index",
31
+ "summary_use_proj": true,
32
+ "tokenizer_class": "GPTSw3Tokenizer",
33
+ "torch_dtype": "bfloat16",
34
+ "transformers_version": "4.38.1",
35
+ "use_cache": false,
36
+ "vocab_size": 64000
37
+ }
gpt-sw3-model/generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.38.1",
7
+ "use_cache": false
8
+ }
gpt-sw3-model/pytorch_model-00001-of-00003.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b5613e9bb03e311bf50ed0ecce4594159dbf1edaf228566b5a8dd3ae5c46bd2
3
+ size 4971486034
gpt-sw3-model/pytorch_model-00002-of-00003.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7fdf1eeefc27df8163b1cf635a8d65ee17eda4f5ca343ad6638a5d9d7b6e1b2
3
+ size 4967435972
gpt-sw3-model/pytorch_model-00003-of-00003.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7d6e0c04f3c19fa3eb66071f588d1d15424b3938570dbe1632248d723a97100
3
+ size 4014894443
gpt-sw3-model/pytorch_model.bin.index.json ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 13953679360
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00003-of-00003.bin",
7
+ "transformer.h.0.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
8
+ "transformer.h.0.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
9
+ "transformer.h.0.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
10
+ "transformer.h.0.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
11
+ "transformer.h.0.ln_1.bias": "pytorch_model-00001-of-00003.bin",
12
+ "transformer.h.0.ln_1.weight": "pytorch_model-00001-of-00003.bin",
13
+ "transformer.h.0.ln_2.bias": "pytorch_model-00001-of-00003.bin",
14
+ "transformer.h.0.ln_2.weight": "pytorch_model-00001-of-00003.bin",
15
+ "transformer.h.0.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
16
+ "transformer.h.0.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
17
+ "transformer.h.0.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
18
+ "transformer.h.0.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
19
+ "transformer.h.1.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
20
+ "transformer.h.1.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
21
+ "transformer.h.1.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
22
+ "transformer.h.1.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
23
+ "transformer.h.1.ln_1.bias": "pytorch_model-00001-of-00003.bin",
24
+ "transformer.h.1.ln_1.weight": "pytorch_model-00001-of-00003.bin",
25
+ "transformer.h.1.ln_2.bias": "pytorch_model-00001-of-00003.bin",
26
+ "transformer.h.1.ln_2.weight": "pytorch_model-00001-of-00003.bin",
27
+ "transformer.h.1.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
28
+ "transformer.h.1.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
29
+ "transformer.h.1.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
30
+ "transformer.h.1.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
31
+ "transformer.h.10.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
32
+ "transformer.h.10.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
33
+ "transformer.h.10.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
34
+ "transformer.h.10.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
35
+ "transformer.h.10.ln_1.bias": "pytorch_model-00001-of-00003.bin",
36
+ "transformer.h.10.ln_1.weight": "pytorch_model-00001-of-00003.bin",
37
+ "transformer.h.10.ln_2.bias": "pytorch_model-00001-of-00003.bin",
38
+ "transformer.h.10.ln_2.weight": "pytorch_model-00001-of-00003.bin",
39
+ "transformer.h.10.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
40
+ "transformer.h.10.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
41
+ "transformer.h.10.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
42
+ "transformer.h.10.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
43
+ "transformer.h.11.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
44
+ "transformer.h.11.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
45
+ "transformer.h.11.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
46
+ "transformer.h.11.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
47
+ "transformer.h.11.ln_1.bias": "pytorch_model-00001-of-00003.bin",
48
+ "transformer.h.11.ln_1.weight": "pytorch_model-00001-of-00003.bin",
49
+ "transformer.h.11.ln_2.bias": "pytorch_model-00002-of-00003.bin",
50
+ "transformer.h.11.ln_2.weight": "pytorch_model-00002-of-00003.bin",
51
+ "transformer.h.11.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
52
+ "transformer.h.11.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
53
+ "transformer.h.11.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
54
+ "transformer.h.11.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
55
+ "transformer.h.12.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
56
+ "transformer.h.12.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
57
+ "transformer.h.12.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
58
+ "transformer.h.12.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
59
+ "transformer.h.12.ln_1.bias": "pytorch_model-00002-of-00003.bin",
60
+ "transformer.h.12.ln_1.weight": "pytorch_model-00002-of-00003.bin",
61
+ "transformer.h.12.ln_2.bias": "pytorch_model-00002-of-00003.bin",
62
+ "transformer.h.12.ln_2.weight": "pytorch_model-00002-of-00003.bin",
63
+ "transformer.h.12.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
64
+ "transformer.h.12.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
65
+ "transformer.h.12.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
66
+ "transformer.h.12.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
67
+ "transformer.h.13.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
68
+ "transformer.h.13.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
69
+ "transformer.h.13.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
70
+ "transformer.h.13.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
71
+ "transformer.h.13.ln_1.bias": "pytorch_model-00002-of-00003.bin",
72
+ "transformer.h.13.ln_1.weight": "pytorch_model-00002-of-00003.bin",
73
+ "transformer.h.13.ln_2.bias": "pytorch_model-00002-of-00003.bin",
74
+ "transformer.h.13.ln_2.weight": "pytorch_model-00002-of-00003.bin",
75
+ "transformer.h.13.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
76
+ "transformer.h.13.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
77
+ "transformer.h.13.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
78
+ "transformer.h.13.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
79
+ "transformer.h.14.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
80
+ "transformer.h.14.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
81
+ "transformer.h.14.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
82
+ "transformer.h.14.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
83
+ "transformer.h.14.ln_1.bias": "pytorch_model-00002-of-00003.bin",
84
+ "transformer.h.14.ln_1.weight": "pytorch_model-00002-of-00003.bin",
85
+ "transformer.h.14.ln_2.bias": "pytorch_model-00002-of-00003.bin",
86
+ "transformer.h.14.ln_2.weight": "pytorch_model-00002-of-00003.bin",
87
+ "transformer.h.14.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
88
+ "transformer.h.14.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
89
+ "transformer.h.14.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
90
+ "transformer.h.14.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
91
+ "transformer.h.15.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
92
+ "transformer.h.15.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
93
+ "transformer.h.15.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
94
+ "transformer.h.15.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
95
+ "transformer.h.15.ln_1.bias": "pytorch_model-00002-of-00003.bin",
96
+ "transformer.h.15.ln_1.weight": "pytorch_model-00002-of-00003.bin",
97
+ "transformer.h.15.ln_2.bias": "pytorch_model-00002-of-00003.bin",
98
+ "transformer.h.15.ln_2.weight": "pytorch_model-00002-of-00003.bin",
99
+ "transformer.h.15.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
100
+ "transformer.h.15.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
101
+ "transformer.h.15.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
102
+ "transformer.h.15.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
103
+ "transformer.h.16.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
104
+ "transformer.h.16.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
105
+ "transformer.h.16.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
106
+ "transformer.h.16.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
107
+ "transformer.h.16.ln_1.bias": "pytorch_model-00002-of-00003.bin",
108
+ "transformer.h.16.ln_1.weight": "pytorch_model-00002-of-00003.bin",
109
+ "transformer.h.16.ln_2.bias": "pytorch_model-00002-of-00003.bin",
110
+ "transformer.h.16.ln_2.weight": "pytorch_model-00002-of-00003.bin",
111
+ "transformer.h.16.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
112
+ "transformer.h.16.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
113
+ "transformer.h.16.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
114
+ "transformer.h.16.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
115
+ "transformer.h.17.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
116
+ "transformer.h.17.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
117
+ "transformer.h.17.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
118
+ "transformer.h.17.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
119
+ "transformer.h.17.ln_1.bias": "pytorch_model-00002-of-00003.bin",
120
+ "transformer.h.17.ln_1.weight": "pytorch_model-00002-of-00003.bin",
121
+ "transformer.h.17.ln_2.bias": "pytorch_model-00002-of-00003.bin",
122
+ "transformer.h.17.ln_2.weight": "pytorch_model-00002-of-00003.bin",
123
+ "transformer.h.17.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
124
+ "transformer.h.17.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
125
+ "transformer.h.17.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
126
+ "transformer.h.17.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
127
+ "transformer.h.18.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
128
+ "transformer.h.18.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
129
+ "transformer.h.18.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
130
+ "transformer.h.18.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
131
+ "transformer.h.18.ln_1.bias": "pytorch_model-00002-of-00003.bin",
132
+ "transformer.h.18.ln_1.weight": "pytorch_model-00002-of-00003.bin",
133
+ "transformer.h.18.ln_2.bias": "pytorch_model-00002-of-00003.bin",
134
+ "transformer.h.18.ln_2.weight": "pytorch_model-00002-of-00003.bin",
135
+ "transformer.h.18.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
136
+ "transformer.h.18.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
137
+ "transformer.h.18.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
138
+ "transformer.h.18.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
139
+ "transformer.h.19.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
140
+ "transformer.h.19.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
141
+ "transformer.h.19.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
142
+ "transformer.h.19.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
143
+ "transformer.h.19.ln_1.bias": "pytorch_model-00002-of-00003.bin",
144
+ "transformer.h.19.ln_1.weight": "pytorch_model-00002-of-00003.bin",
145
+ "transformer.h.19.ln_2.bias": "pytorch_model-00002-of-00003.bin",
146
+ "transformer.h.19.ln_2.weight": "pytorch_model-00002-of-00003.bin",
147
+ "transformer.h.19.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
148
+ "transformer.h.19.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
149
+ "transformer.h.19.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
150
+ "transformer.h.19.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
151
+ "transformer.h.2.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
152
+ "transformer.h.2.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
153
+ "transformer.h.2.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
154
+ "transformer.h.2.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
155
+ "transformer.h.2.ln_1.bias": "pytorch_model-00001-of-00003.bin",
156
+ "transformer.h.2.ln_1.weight": "pytorch_model-00001-of-00003.bin",
157
+ "transformer.h.2.ln_2.bias": "pytorch_model-00001-of-00003.bin",
158
+ "transformer.h.2.ln_2.weight": "pytorch_model-00001-of-00003.bin",
159
+ "transformer.h.2.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
160
+ "transformer.h.2.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
161
+ "transformer.h.2.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
162
+ "transformer.h.2.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
163
+ "transformer.h.20.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
164
+ "transformer.h.20.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
165
+ "transformer.h.20.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
166
+ "transformer.h.20.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
167
+ "transformer.h.20.ln_1.bias": "pytorch_model-00002-of-00003.bin",
168
+ "transformer.h.20.ln_1.weight": "pytorch_model-00002-of-00003.bin",
169
+ "transformer.h.20.ln_2.bias": "pytorch_model-00002-of-00003.bin",
170
+ "transformer.h.20.ln_2.weight": "pytorch_model-00002-of-00003.bin",
171
+ "transformer.h.20.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
172
+ "transformer.h.20.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
173
+ "transformer.h.20.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
174
+ "transformer.h.20.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
175
+ "transformer.h.21.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
176
+ "transformer.h.21.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
177
+ "transformer.h.21.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
178
+ "transformer.h.21.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
179
+ "transformer.h.21.ln_1.bias": "pytorch_model-00002-of-00003.bin",
180
+ "transformer.h.21.ln_1.weight": "pytorch_model-00002-of-00003.bin",
181
+ "transformer.h.21.ln_2.bias": "pytorch_model-00002-of-00003.bin",
182
+ "transformer.h.21.ln_2.weight": "pytorch_model-00002-of-00003.bin",
183
+ "transformer.h.21.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
184
+ "transformer.h.21.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
185
+ "transformer.h.21.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
186
+ "transformer.h.21.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
187
+ "transformer.h.22.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
188
+ "transformer.h.22.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
189
+ "transformer.h.22.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
190
+ "transformer.h.22.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
191
+ "transformer.h.22.ln_1.bias": "pytorch_model-00002-of-00003.bin",
192
+ "transformer.h.22.ln_1.weight": "pytorch_model-00002-of-00003.bin",
193
+ "transformer.h.22.ln_2.bias": "pytorch_model-00002-of-00003.bin",
194
+ "transformer.h.22.ln_2.weight": "pytorch_model-00002-of-00003.bin",
195
+ "transformer.h.22.mlp.c_fc.bias": "pytorch_model-00002-of-00003.bin",
196
+ "transformer.h.22.mlp.c_fc.weight": "pytorch_model-00002-of-00003.bin",
197
+ "transformer.h.22.mlp.c_proj.bias": "pytorch_model-00002-of-00003.bin",
198
+ "transformer.h.22.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
199
+ "transformer.h.23.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
200
+ "transformer.h.23.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
201
+ "transformer.h.23.attn.c_proj.bias": "pytorch_model-00002-of-00003.bin",
202
+ "transformer.h.23.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
203
+ "transformer.h.23.ln_1.bias": "pytorch_model-00002-of-00003.bin",
204
+ "transformer.h.23.ln_1.weight": "pytorch_model-00002-of-00003.bin",
205
+ "transformer.h.23.ln_2.bias": "pytorch_model-00002-of-00003.bin",
206
+ "transformer.h.23.ln_2.weight": "pytorch_model-00002-of-00003.bin",
207
+ "transformer.h.23.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
208
+ "transformer.h.23.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
209
+ "transformer.h.23.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
210
+ "transformer.h.23.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
211
+ "transformer.h.24.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
212
+ "transformer.h.24.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
213
+ "transformer.h.24.attn.c_proj.bias": "pytorch_model-00003-of-00003.bin",
214
+ "transformer.h.24.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
215
+ "transformer.h.24.ln_1.bias": "pytorch_model-00003-of-00003.bin",
216
+ "transformer.h.24.ln_1.weight": "pytorch_model-00003-of-00003.bin",
217
+ "transformer.h.24.ln_2.bias": "pytorch_model-00003-of-00003.bin",
218
+ "transformer.h.24.ln_2.weight": "pytorch_model-00003-of-00003.bin",
219
+ "transformer.h.24.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
220
+ "transformer.h.24.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
221
+ "transformer.h.24.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
222
+ "transformer.h.24.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
223
+ "transformer.h.25.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
224
+ "transformer.h.25.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
225
+ "transformer.h.25.attn.c_proj.bias": "pytorch_model-00003-of-00003.bin",
226
+ "transformer.h.25.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
227
+ "transformer.h.25.ln_1.bias": "pytorch_model-00003-of-00003.bin",
228
+ "transformer.h.25.ln_1.weight": "pytorch_model-00003-of-00003.bin",
229
+ "transformer.h.25.ln_2.bias": "pytorch_model-00003-of-00003.bin",
230
+ "transformer.h.25.ln_2.weight": "pytorch_model-00003-of-00003.bin",
231
+ "transformer.h.25.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
232
+ "transformer.h.25.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
233
+ "transformer.h.25.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
234
+ "transformer.h.25.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
235
+ "transformer.h.26.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
236
+ "transformer.h.26.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
237
+ "transformer.h.26.attn.c_proj.bias": "pytorch_model-00003-of-00003.bin",
238
+ "transformer.h.26.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
239
+ "transformer.h.26.ln_1.bias": "pytorch_model-00003-of-00003.bin",
240
+ "transformer.h.26.ln_1.weight": "pytorch_model-00003-of-00003.bin",
241
+ "transformer.h.26.ln_2.bias": "pytorch_model-00003-of-00003.bin",
242
+ "transformer.h.26.ln_2.weight": "pytorch_model-00003-of-00003.bin",
243
+ "transformer.h.26.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
244
+ "transformer.h.26.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
245
+ "transformer.h.26.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
246
+ "transformer.h.26.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
247
+ "transformer.h.27.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
248
+ "transformer.h.27.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
249
+ "transformer.h.27.attn.c_proj.bias": "pytorch_model-00003-of-00003.bin",
250
+ "transformer.h.27.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
251
+ "transformer.h.27.ln_1.bias": "pytorch_model-00003-of-00003.bin",
252
+ "transformer.h.27.ln_1.weight": "pytorch_model-00003-of-00003.bin",
253
+ "transformer.h.27.ln_2.bias": "pytorch_model-00003-of-00003.bin",
254
+ "transformer.h.27.ln_2.weight": "pytorch_model-00003-of-00003.bin",
255
+ "transformer.h.27.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
256
+ "transformer.h.27.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
257
+ "transformer.h.27.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
258
+ "transformer.h.27.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
259
+ "transformer.h.28.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
260
+ "transformer.h.28.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
261
+ "transformer.h.28.attn.c_proj.bias": "pytorch_model-00003-of-00003.bin",
262
+ "transformer.h.28.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
263
+ "transformer.h.28.ln_1.bias": "pytorch_model-00003-of-00003.bin",
264
+ "transformer.h.28.ln_1.weight": "pytorch_model-00003-of-00003.bin",
265
+ "transformer.h.28.ln_2.bias": "pytorch_model-00003-of-00003.bin",
266
+ "transformer.h.28.ln_2.weight": "pytorch_model-00003-of-00003.bin",
267
+ "transformer.h.28.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
268
+ "transformer.h.28.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
269
+ "transformer.h.28.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
270
+ "transformer.h.28.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
271
+ "transformer.h.29.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
272
+ "transformer.h.29.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
273
+ "transformer.h.29.attn.c_proj.bias": "pytorch_model-00003-of-00003.bin",
274
+ "transformer.h.29.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
275
+ "transformer.h.29.ln_1.bias": "pytorch_model-00003-of-00003.bin",
276
+ "transformer.h.29.ln_1.weight": "pytorch_model-00003-of-00003.bin",
277
+ "transformer.h.29.ln_2.bias": "pytorch_model-00003-of-00003.bin",
278
+ "transformer.h.29.ln_2.weight": "pytorch_model-00003-of-00003.bin",
279
+ "transformer.h.29.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
280
+ "transformer.h.29.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
281
+ "transformer.h.29.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
282
+ "transformer.h.29.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
283
+ "transformer.h.3.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
284
+ "transformer.h.3.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
285
+ "transformer.h.3.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
286
+ "transformer.h.3.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
287
+ "transformer.h.3.ln_1.bias": "pytorch_model-00001-of-00003.bin",
288
+ "transformer.h.3.ln_1.weight": "pytorch_model-00001-of-00003.bin",
289
+ "transformer.h.3.ln_2.bias": "pytorch_model-00001-of-00003.bin",
290
+ "transformer.h.3.ln_2.weight": "pytorch_model-00001-of-00003.bin",
291
+ "transformer.h.3.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
292
+ "transformer.h.3.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
293
+ "transformer.h.3.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
294
+ "transformer.h.3.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
295
+ "transformer.h.30.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
296
+ "transformer.h.30.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
297
+ "transformer.h.30.attn.c_proj.bias": "pytorch_model-00003-of-00003.bin",
298
+ "transformer.h.30.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
299
+ "transformer.h.30.ln_1.bias": "pytorch_model-00003-of-00003.bin",
300
+ "transformer.h.30.ln_1.weight": "pytorch_model-00003-of-00003.bin",
301
+ "transformer.h.30.ln_2.bias": "pytorch_model-00003-of-00003.bin",
302
+ "transformer.h.30.ln_2.weight": "pytorch_model-00003-of-00003.bin",
303
+ "transformer.h.30.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
304
+ "transformer.h.30.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
305
+ "transformer.h.30.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
306
+ "transformer.h.30.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
307
+ "transformer.h.31.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
308
+ "transformer.h.31.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
309
+ "transformer.h.31.attn.c_proj.bias": "pytorch_model-00003-of-00003.bin",
310
+ "transformer.h.31.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
311
+ "transformer.h.31.ln_1.bias": "pytorch_model-00003-of-00003.bin",
312
+ "transformer.h.31.ln_1.weight": "pytorch_model-00003-of-00003.bin",
313
+ "transformer.h.31.ln_2.bias": "pytorch_model-00003-of-00003.bin",
314
+ "transformer.h.31.ln_2.weight": "pytorch_model-00003-of-00003.bin",
315
+ "transformer.h.31.mlp.c_fc.bias": "pytorch_model-00003-of-00003.bin",
316
+ "transformer.h.31.mlp.c_fc.weight": "pytorch_model-00003-of-00003.bin",
317
+ "transformer.h.31.mlp.c_proj.bias": "pytorch_model-00003-of-00003.bin",
318
+ "transformer.h.31.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
319
+ "transformer.h.4.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
320
+ "transformer.h.4.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
321
+ "transformer.h.4.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
322
+ "transformer.h.4.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
323
+ "transformer.h.4.ln_1.bias": "pytorch_model-00001-of-00003.bin",
324
+ "transformer.h.4.ln_1.weight": "pytorch_model-00001-of-00003.bin",
325
+ "transformer.h.4.ln_2.bias": "pytorch_model-00001-of-00003.bin",
326
+ "transformer.h.4.ln_2.weight": "pytorch_model-00001-of-00003.bin",
327
+ "transformer.h.4.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
328
+ "transformer.h.4.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
329
+ "transformer.h.4.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
330
+ "transformer.h.4.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
331
+ "transformer.h.5.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
332
+ "transformer.h.5.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
333
+ "transformer.h.5.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
334
+ "transformer.h.5.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
335
+ "transformer.h.5.ln_1.bias": "pytorch_model-00001-of-00003.bin",
336
+ "transformer.h.5.ln_1.weight": "pytorch_model-00001-of-00003.bin",
337
+ "transformer.h.5.ln_2.bias": "pytorch_model-00001-of-00003.bin",
338
+ "transformer.h.5.ln_2.weight": "pytorch_model-00001-of-00003.bin",
339
+ "transformer.h.5.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
340
+ "transformer.h.5.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
341
+ "transformer.h.5.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
342
+ "transformer.h.5.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
343
+ "transformer.h.6.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
344
+ "transformer.h.6.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
345
+ "transformer.h.6.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
346
+ "transformer.h.6.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
347
+ "transformer.h.6.ln_1.bias": "pytorch_model-00001-of-00003.bin",
348
+ "transformer.h.6.ln_1.weight": "pytorch_model-00001-of-00003.bin",
349
+ "transformer.h.6.ln_2.bias": "pytorch_model-00001-of-00003.bin",
350
+ "transformer.h.6.ln_2.weight": "pytorch_model-00001-of-00003.bin",
351
+ "transformer.h.6.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
352
+ "transformer.h.6.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
353
+ "transformer.h.6.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
354
+ "transformer.h.6.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
355
+ "transformer.h.7.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
356
+ "transformer.h.7.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
357
+ "transformer.h.7.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
358
+ "transformer.h.7.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
359
+ "transformer.h.7.ln_1.bias": "pytorch_model-00001-of-00003.bin",
360
+ "transformer.h.7.ln_1.weight": "pytorch_model-00001-of-00003.bin",
361
+ "transformer.h.7.ln_2.bias": "pytorch_model-00001-of-00003.bin",
362
+ "transformer.h.7.ln_2.weight": "pytorch_model-00001-of-00003.bin",
363
+ "transformer.h.7.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
364
+ "transformer.h.7.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
365
+ "transformer.h.7.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
366
+ "transformer.h.7.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
367
+ "transformer.h.8.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
368
+ "transformer.h.8.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
369
+ "transformer.h.8.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
370
+ "transformer.h.8.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
371
+ "transformer.h.8.ln_1.bias": "pytorch_model-00001-of-00003.bin",
372
+ "transformer.h.8.ln_1.weight": "pytorch_model-00001-of-00003.bin",
373
+ "transformer.h.8.ln_2.bias": "pytorch_model-00001-of-00003.bin",
374
+ "transformer.h.8.ln_2.weight": "pytorch_model-00001-of-00003.bin",
375
+ "transformer.h.8.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
376
+ "transformer.h.8.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
377
+ "transformer.h.8.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
378
+ "transformer.h.8.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
379
+ "transformer.h.9.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
380
+ "transformer.h.9.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
381
+ "transformer.h.9.attn.c_proj.bias": "pytorch_model-00001-of-00003.bin",
382
+ "transformer.h.9.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
383
+ "transformer.h.9.ln_1.bias": "pytorch_model-00001-of-00003.bin",
384
+ "transformer.h.9.ln_1.weight": "pytorch_model-00001-of-00003.bin",
385
+ "transformer.h.9.ln_2.bias": "pytorch_model-00001-of-00003.bin",
386
+ "transformer.h.9.ln_2.weight": "pytorch_model-00001-of-00003.bin",
387
+ "transformer.h.9.mlp.c_fc.bias": "pytorch_model-00001-of-00003.bin",
388
+ "transformer.h.9.mlp.c_fc.weight": "pytorch_model-00001-of-00003.bin",
389
+ "transformer.h.9.mlp.c_proj.bias": "pytorch_model-00001-of-00003.bin",
390
+ "transformer.h.9.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
391
+ "transformer.ln_f.bias": "pytorch_model-00003-of-00003.bin",
392
+ "transformer.ln_f.weight": "pytorch_model-00003-of-00003.bin",
393
+ "transformer.wpe.weight": "pytorch_model-00001-of-00003.bin",
394
+ "transformer.wte.weight": "pytorch_model-00001-of-00003.bin"
395
+ }
396
+ }
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ torch==2.2.1
2
+ transformers==4.38.2
3
+ tqdm==4.66.2
run_model.py ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """This script runs the trained model on data and saves the predictions to a file."""
2
+
3
+ from transformers import AutoModelForCausalLM, AutoTokenizer
4
+ import torch
5
+ import logging
6
+ import random
7
+ import tqdm
8
+ import json
9
+ import argparse
10
+
11
+ # Set the logging level to info
12
+ logging.basicConfig(level=logging.INFO)
13
+
14
+ # Set the device to GPU if available
15
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
16
+ logging.info(f"Device: {device}")
17
+
18
+ # Prompts for the different tasks
19
+ START_PROMPT_TASK1 = "Hér er texti sem ég vil að þú skoðir vel og vandlega. Þú skalt skoða hvert einasta orð, orðasamband, og setningu og meta hvort þér finnist eitthvað athugavert, til dæmis hvað varðar málfræði, stafsetningu, skringilega merkingu og svo framvegis.\nHér er textinn:\n\n"
20
+ END_PROMPT_TASK1 = "Sérðu eitthvað sem mætti betur fara í textanum? Búðu til lista af öllum slíkum tilvikum þar sem hver lína tilgreinir hver villan er, hvar hún er, og hvað væri gert í staðinn fyrir villuna.\n\n"
21
+
22
+ START_PROMPT_TASK2 = "Hér er texti sem ég vil að þú skoðir vel og vandlega. Þú skalt skoða hvert einasta orð, orðasamband, og setningu og meta hvort þér finnist eitthvað athugavert, til dæmis hvað varðar málfræði, stafsetningu, skringilega merkingu og svo framvegis.Ég er með tvær útgáfur af textanum, A og B, og önnur þeirra gæti verið betri en hin á einhvern hátt, t.d. hvað varðar stafsetningu, málfræði o.s.frv.\nHér er texti A:\n\n"
23
+ MIDDLE_PROMPT_TASK2 = "Hér er texti B:\n\n"
24
+ END_PROMPT_TASK2 = "Hvorn textann líst þér betur á?\n\n"
25
+
26
+ START_PROMPT_TASK3 = "Hér er texti sem ég vil að þú skoðir vel og vandlega. Þú skalt skoða hvert einasta orð, orðasamband, og setningu og meta hvort þér finnist eitthvað athugavert, til dæmis hvað varðar málfræði, stafsetningu, skringilega merkingu og svo framvegis.\nHér er textinn:\n\n"
27
+ END_PROMPT_TASK3 = "Reyndu nú að laga textann þannig að hann líti betur út, eins og þér finnst best við hæfi.\n\n"
28
+
29
+ START_PROMPT_TASK = {
30
+ 1: START_PROMPT_TASK1,
31
+ 2: START_PROMPT_TASK2,
32
+ 3: START_PROMPT_TASK3,
33
+ }
34
+ END_PROMPT_TASK = {1: END_PROMPT_TASK1, 2: END_PROMPT_TASK2, 3: END_PROMPT_TASK3}
35
+
36
+ SEP = "\n\n"
37
+
38
+
39
+ def set_seed(seed):
40
+ """Set the random seed for reproducibility."""
41
+ torch.manual_seed(seed)
42
+ if torch.cuda.is_available():
43
+ torch.cuda.manual_seed_all(seed)
44
+ torch.backends.cudnn.deterministic = True
45
+ torch.backends.cudnn.benchmark = False
46
+ random.seed(seed)
47
+
48
+
49
+ def tokenize_data(tokenizer, data, task, max_length):
50
+ """Tokenize the data and return the input_ids and attention_mask."""
51
+ tokenized_start = tokenizer(START_PROMPT_TASK[task])["input_ids"]
52
+ tokenized_end = tokenizer(END_PROMPT_TASK[task])["input_ids"]
53
+ if task == 2:
54
+ tokenized_middle = tokenizer(MIDDLE_PROMPT_TASK2)["input_ids"]
55
+
56
+ # Tokenize the data
57
+ tokenized_data = []
58
+ if task == 1 or task == 3:
59
+ for sentence in data:
60
+ tokenized_sentence = tokenizer(sentence + SEP)["input_ids"]
61
+
62
+ # Concatenate the tokenized data
63
+ concatted_data = (
64
+ [tokenizer.bos_token_id]
65
+ + tokenized_start
66
+ + tokenized_sentence
67
+ + tokenized_end
68
+ )
69
+
70
+ # Truncate the data
71
+ concatted_data = concatted_data[:max_length]
72
+
73
+ tokenized_data.append(concatted_data)
74
+ elif task == 2:
75
+ for line in data:
76
+ data_a = line["a"]
77
+ data_b = line["b"]
78
+ tokenized_sentence_a = tokenizer(data_a + SEP)["input_ids"]
79
+ tokenized_sentence_b = tokenizer(data_b + SEP)["input_ids"]
80
+
81
+ # Concatenate the tokenized data
82
+ concatted_data = (
83
+ [tokenizer.bos_token_id]
84
+ + tokenized_start
85
+ + tokenized_sentence_a
86
+ + tokenized_middle
87
+ + tokenized_sentence_b
88
+ + tokenized_end
89
+ )
90
+
91
+ # Truncate the data
92
+ concatted_data = concatted_data[:max_length]
93
+
94
+ tokenized_data.append(concatted_data)
95
+
96
+ return tokenized_data
97
+
98
+
99
+ def run_model_on_data(model_path, tokenizer_name, arguments):
100
+ """Run the model on the data and save the predictions to a file."""
101
+ # Load the model and tokenizer
102
+ model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.bfloat16)
103
+ model.to(device)
104
+ model.eval()
105
+ tokenizer = AutoTokenizer.from_pretrained(tokenizer_name)
106
+
107
+ # Load the data
108
+ if arguments.task == 1 or arguments.task == 3:
109
+ with open(arguments.input_file, "r") as file:
110
+ data = file.read().splitlines()
111
+ elif arguments.task == 2:
112
+ with open(arguments.input_file, "r") as file:
113
+ data = file.read().splitlines()
114
+ data = [json.loads(line) for line in data]
115
+
116
+ # Tokenize the data
117
+ data_tokenized = tokenize_data(
118
+ tokenizer, data, arguments.task, tokenizer.model_max_length
119
+ )
120
+ logging.info(f"Number of examples: {len(data_tokenized)}")
121
+
122
+ # Run the model on the data
123
+ predictions = []
124
+ progress_bar = tqdm.tqdm(total=len(data_tokenized), desc="Running model on data")
125
+
126
+ for input_ids in data_tokenized:
127
+ progress_bar.update(1)
128
+
129
+ # Generate the predictions
130
+ with torch.cuda.amp.autocast(dtype=torch.bfloat16):
131
+ input_ids_tensor = torch.tensor(input_ids).unsqueeze(0).to(device)
132
+ output = model.generate(
133
+ input_ids=input_ids_tensor, max_new_tokens=500, num_return_sequences=1
134
+ )
135
+
136
+ # Only get the part of the prediction that was generated
137
+ prediction = tokenizer.decode(
138
+ output[0][len(input_ids) :], skip_special_tokens=True
139
+ )
140
+ predictions.append(prediction)
141
+
142
+ progress_bar.close()
143
+
144
+ # Save the predictions to a file
145
+ with open(arguments.output_file, "w") as file:
146
+ if arguments.task == 1:
147
+ # We want to include the original text in the output file
148
+ counter = 0
149
+ for prediction in predictions:
150
+ file.write(data[counter] + "\n")
151
+ file.write(prediction.split("\n\n")[0] + "\n\n")
152
+ counter += 1
153
+ else:
154
+ for prediction in predictions:
155
+ file.write(prediction.split("\n\n")[0] + "\n")
156
+
157
+ logging.info(f"Predictions written to file: {arguments.output_file}")
158
+
159
+
160
+ if __name__ == "__main__":
161
+ # Parse the arguments
162
+ parser = argparse.ArgumentParser()
163
+ parser.add_argument("--task", type=int, help="The task type (1, 2, or 3)")
164
+ parser.add_argument(
165
+ "--input-file",
166
+ type=str,
167
+ help="The path to the input file with data to be corrected",
168
+ )
169
+ parser.add_argument(
170
+ "--output-file",
171
+ type=str,
172
+ help="The path to the output file where the corrected data will be saved",
173
+ )
174
+ args = parser.parse_args()
175
+
176
+ model_path = "./gpt-sw3-model"
177
+ tokenizer_name = "AI-Sweden-Models/gpt-sw3-6.7b"
178
+
179
+ set_seed(42)
180
+ run_model_on_data(model_path, tokenizer_name, args)