Spaces:
Runtime error
Runtime error
akshaytrikha
commited on
Commit
•
89b5cec
1
Parent(s):
ba07099
use gpt2-medium
Browse files- app.py +1 -1
- model/gpt2-355M/config.json +38 -0
- model/gpt2-355M/pytorch_model.bin +3 -0
- model/gpt2-355M/trainer_state.json +256 -0
app.py
CHANGED
@@ -5,7 +5,7 @@ import torch
|
|
5 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
6 |
|
7 |
# load pretrained + finetuned GPT2
|
8 |
-
model = GPT2LMHeadModel.from_pretrained("./model/gpt2-
|
9 |
model = model.to(device)
|
10 |
|
11 |
# create tokenizer
|
|
|
5 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
6 |
|
7 |
# load pretrained + finetuned GPT2
|
8 |
+
model = GPT2LMHeadModel.from_pretrained("./model/gpt2-355M")
|
9 |
model = model.to(device)
|
10 |
|
11 |
# create tokenizer
|
model/gpt2-355M/config.json
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "gpt2-medium",
|
3 |
+
"activation_function": "gelu_new",
|
4 |
+
"architectures": [
|
5 |
+
"GPT2LMHeadModel"
|
6 |
+
],
|
7 |
+
"attn_pdrop": 0.1,
|
8 |
+
"bos_token_id": 50256,
|
9 |
+
"embd_pdrop": 0.1,
|
10 |
+
"eos_token_id": 50256,
|
11 |
+
"gradient_checkpointing": false,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"layer_norm_epsilon": 1e-05,
|
14 |
+
"model_type": "gpt2",
|
15 |
+
"n_ctx": 1024,
|
16 |
+
"n_embd": 1024,
|
17 |
+
"n_head": 16,
|
18 |
+
"n_inner": null,
|
19 |
+
"n_layer": 24,
|
20 |
+
"n_positions": 1024,
|
21 |
+
"n_special": 0,
|
22 |
+
"predict_special_tokens": true,
|
23 |
+
"resid_pdrop": 0.1,
|
24 |
+
"summary_activation": null,
|
25 |
+
"summary_first_dropout": 0.1,
|
26 |
+
"summary_proj_to_labels": true,
|
27 |
+
"summary_type": "cls_index",
|
28 |
+
"summary_use_proj": true,
|
29 |
+
"task_specific_params": {
|
30 |
+
"text-generation": {
|
31 |
+
"do_sample": true,
|
32 |
+
"max_length": 50
|
33 |
+
}
|
34 |
+
},
|
35 |
+
"transformers_version": "4.2.2",
|
36 |
+
"use_cache": true,
|
37 |
+
"vocab_size": 50257
|
38 |
+
}
|
model/gpt2-355M/pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6b0e684952adc84a05d296c526ead3c19827b804bb60ebaacc8857550efc3b9a
|
3 |
+
size 1444583837
|
model/gpt2-355M/trainer_state.json
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_metric": null,
|
3 |
+
"best_model_checkpoint": null,
|
4 |
+
"epoch": 14.662756598240469,
|
5 |
+
"global_step": 20000,
|
6 |
+
"is_hyper_param_search": false,
|
7 |
+
"is_local_process_zero": true,
|
8 |
+
"is_world_process_zero": true,
|
9 |
+
"log_history": [
|
10 |
+
{
|
11 |
+
"epoch": 0.37,
|
12 |
+
"learning_rate": 5e-05,
|
13 |
+
"loss": 3.6227,
|
14 |
+
"step": 500
|
15 |
+
},
|
16 |
+
{
|
17 |
+
"epoch": 0.73,
|
18 |
+
"learning_rate": 4.8747494989979966e-05,
|
19 |
+
"loss": 3.3016,
|
20 |
+
"step": 1000
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"epoch": 1.1,
|
24 |
+
"learning_rate": 4.7494989979959916e-05,
|
25 |
+
"loss": 3.1452,
|
26 |
+
"step": 1500
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"epoch": 1.47,
|
30 |
+
"learning_rate": 4.624248496993988e-05,
|
31 |
+
"loss": 2.932,
|
32 |
+
"step": 2000
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"epoch": 1.83,
|
36 |
+
"learning_rate": 4.4989979959919844e-05,
|
37 |
+
"loss": 2.925,
|
38 |
+
"step": 2500
|
39 |
+
},
|
40 |
+
{
|
41 |
+
"epoch": 2.2,
|
42 |
+
"learning_rate": 4.37374749498998e-05,
|
43 |
+
"loss": 2.7771,
|
44 |
+
"step": 3000
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"epoch": 2.57,
|
48 |
+
"learning_rate": 4.248496993987976e-05,
|
49 |
+
"loss": 2.6615,
|
50 |
+
"step": 3500
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"epoch": 2.93,
|
54 |
+
"learning_rate": 4.123246492985972e-05,
|
55 |
+
"loss": 2.6681,
|
56 |
+
"step": 4000
|
57 |
+
},
|
58 |
+
{
|
59 |
+
"epoch": 3.3,
|
60 |
+
"learning_rate": 3.997995991983968e-05,
|
61 |
+
"loss": 2.4825,
|
62 |
+
"step": 4500
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"epoch": 3.67,
|
66 |
+
"learning_rate": 3.872745490981964e-05,
|
67 |
+
"loss": 2.4556,
|
68 |
+
"step": 5000
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"epoch": 4.03,
|
72 |
+
"learning_rate": 3.74749498997996e-05,
|
73 |
+
"loss": 2.4436,
|
74 |
+
"step": 5500
|
75 |
+
},
|
76 |
+
{
|
77 |
+
"epoch": 4.4,
|
78 |
+
"learning_rate": 3.6222444889779564e-05,
|
79 |
+
"loss": 2.2667,
|
80 |
+
"step": 6000
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"epoch": 4.77,
|
84 |
+
"learning_rate": 3.496993987975952e-05,
|
85 |
+
"loss": 2.2716,
|
86 |
+
"step": 6500
|
87 |
+
},
|
88 |
+
{
|
89 |
+
"epoch": 5.13,
|
90 |
+
"learning_rate": 3.371743486973948e-05,
|
91 |
+
"loss": 2.2282,
|
92 |
+
"step": 7000
|
93 |
+
},
|
94 |
+
{
|
95 |
+
"epoch": 5.5,
|
96 |
+
"learning_rate": 3.246492985971944e-05,
|
97 |
+
"loss": 2.1086,
|
98 |
+
"step": 7500
|
99 |
+
},
|
100 |
+
{
|
101 |
+
"epoch": 5.87,
|
102 |
+
"learning_rate": 3.12124248496994e-05,
|
103 |
+
"loss": 2.1339,
|
104 |
+
"step": 8000
|
105 |
+
},
|
106 |
+
{
|
107 |
+
"epoch": 6.23,
|
108 |
+
"learning_rate": 2.9959919839679363e-05,
|
109 |
+
"loss": 2.0177,
|
110 |
+
"step": 8500
|
111 |
+
},
|
112 |
+
{
|
113 |
+
"epoch": 6.6,
|
114 |
+
"learning_rate": 2.870741482965932e-05,
|
115 |
+
"loss": 1.9853,
|
116 |
+
"step": 9000
|
117 |
+
},
|
118 |
+
{
|
119 |
+
"epoch": 6.96,
|
120 |
+
"learning_rate": 2.745490981963928e-05,
|
121 |
+
"loss": 1.9993,
|
122 |
+
"step": 9500
|
123 |
+
},
|
124 |
+
{
|
125 |
+
"epoch": 7.33,
|
126 |
+
"learning_rate": 2.620240480961924e-05,
|
127 |
+
"loss": 1.859,
|
128 |
+
"step": 10000
|
129 |
+
},
|
130 |
+
{
|
131 |
+
"epoch": 7.7,
|
132 |
+
"learning_rate": 2.49498997995992e-05,
|
133 |
+
"loss": 1.8696,
|
134 |
+
"step": 10500
|
135 |
+
},
|
136 |
+
{
|
137 |
+
"epoch": 8.06,
|
138 |
+
"learning_rate": 2.3697394789579158e-05,
|
139 |
+
"loss": 1.858,
|
140 |
+
"step": 11000
|
141 |
+
},
|
142 |
+
{
|
143 |
+
"epoch": 8.43,
|
144 |
+
"learning_rate": 2.244488977955912e-05,
|
145 |
+
"loss": 1.7593,
|
146 |
+
"step": 11500
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"epoch": 8.8,
|
150 |
+
"learning_rate": 2.119238476953908e-05,
|
151 |
+
"loss": 1.7654,
|
152 |
+
"step": 12000
|
153 |
+
},
|
154 |
+
{
|
155 |
+
"epoch": 9.16,
|
156 |
+
"learning_rate": 1.993987975951904e-05,
|
157 |
+
"loss": 1.7326,
|
158 |
+
"step": 12500
|
159 |
+
},
|
160 |
+
{
|
161 |
+
"epoch": 9.53,
|
162 |
+
"learning_rate": 1.8687374749499e-05,
|
163 |
+
"loss": 1.6704,
|
164 |
+
"step": 13000
|
165 |
+
},
|
166 |
+
{
|
167 |
+
"epoch": 9.9,
|
168 |
+
"learning_rate": 1.743486973947896e-05,
|
169 |
+
"loss": 1.689,
|
170 |
+
"step": 13500
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"epoch": 10.26,
|
174 |
+
"learning_rate": 1.6182364729458917e-05,
|
175 |
+
"loss": 1.6195,
|
176 |
+
"step": 14000
|
177 |
+
},
|
178 |
+
{
|
179 |
+
"epoch": 10.63,
|
180 |
+
"learning_rate": 1.492985971943888e-05,
|
181 |
+
"loss": 1.6111,
|
182 |
+
"step": 14500
|
183 |
+
},
|
184 |
+
{
|
185 |
+
"epoch": 11.0,
|
186 |
+
"learning_rate": 1.3677354709418838e-05,
|
187 |
+
"loss": 1.6198,
|
188 |
+
"step": 15000
|
189 |
+
},
|
190 |
+
{
|
191 |
+
"epoch": 11.36,
|
192 |
+
"learning_rate": 1.2424849699398798e-05,
|
193 |
+
"loss": 1.5393,
|
194 |
+
"step": 15500
|
195 |
+
},
|
196 |
+
{
|
197 |
+
"epoch": 11.73,
|
198 |
+
"learning_rate": 1.1172344689378759e-05,
|
199 |
+
"loss": 1.5502,
|
200 |
+
"step": 16000
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"epoch": 12.1,
|
204 |
+
"learning_rate": 9.919839679358718e-06,
|
205 |
+
"loss": 1.5391,
|
206 |
+
"step": 16500
|
207 |
+
},
|
208 |
+
{
|
209 |
+
"epoch": 12.46,
|
210 |
+
"learning_rate": 8.667334669338678e-06,
|
211 |
+
"loss": 1.4915,
|
212 |
+
"step": 17000
|
213 |
+
},
|
214 |
+
{
|
215 |
+
"epoch": 12.83,
|
216 |
+
"learning_rate": 7.414829659318638e-06,
|
217 |
+
"loss": 1.507,
|
218 |
+
"step": 17500
|
219 |
+
},
|
220 |
+
{
|
221 |
+
"epoch": 13.2,
|
222 |
+
"learning_rate": 6.162324649298597e-06,
|
223 |
+
"loss": 1.4794,
|
224 |
+
"step": 18000
|
225 |
+
},
|
226 |
+
{
|
227 |
+
"epoch": 13.56,
|
228 |
+
"learning_rate": 4.9098196392785576e-06,
|
229 |
+
"loss": 1.4626,
|
230 |
+
"step": 18500
|
231 |
+
},
|
232 |
+
{
|
233 |
+
"epoch": 13.93,
|
234 |
+
"learning_rate": 3.6573146292585176e-06,
|
235 |
+
"loss": 1.464,
|
236 |
+
"step": 19000
|
237 |
+
},
|
238 |
+
{
|
239 |
+
"epoch": 14.3,
|
240 |
+
"learning_rate": 2.404809619238477e-06,
|
241 |
+
"loss": 1.4426,
|
242 |
+
"step": 19500
|
243 |
+
},
|
244 |
+
{
|
245 |
+
"epoch": 14.66,
|
246 |
+
"learning_rate": 1.152304609218437e-06,
|
247 |
+
"loss": 1.4393,
|
248 |
+
"step": 20000
|
249 |
+
}
|
250 |
+
],
|
251 |
+
"max_steps": 20460,
|
252 |
+
"num_train_epochs": 15,
|
253 |
+
"total_flos": 43573965472923648,
|
254 |
+
"trial_name": null,
|
255 |
+
"trial_params": null
|
256 |
+
}
|