X1AOX1A commited on
Commit
acdcb1e
·
1 Parent(s): acfc3db

init commit

Browse files
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ __pycache__
UniPoll-t5/best_model/added_tokens.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "<c>": 50001,
3
+ "<choices>": 50003,
4
+ "<title>": 50002,
5
+ "digit": 50000
6
+ }
UniPoll-t5/best_model/config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/root/Documents/CODES/UniPoll/checkpoints/imxly/t5-pegasus",
3
+ "architectures": [
4
+ "MT5ForConditionalGeneration"
5
+ ],
6
+ "d_ff": 2048,
7
+ "d_kv": 64,
8
+ "d_model": 768,
9
+ "decoder_start_token_id": 0,
10
+ "dense_act_fn": "gelu_new",
11
+ "dropout_rate": 0.1,
12
+ "eos_token_id": 1,
13
+ "feed_forward_proj": "gated-gelu",
14
+ "initializer_factor": 1.0,
15
+ "is_encoder_decoder": true,
16
+ "is_gated_act": true,
17
+ "layer_norm_epsilon": 1e-06,
18
+ "model_type": "mt5",
19
+ "num_decoder_layers": 12,
20
+ "num_heads": 12,
21
+ "num_layers": 12,
22
+ "output_past": true,
23
+ "pad_token_id": 0,
24
+ "relative_attention_max_distance": 128,
25
+ "relative_attention_num_buckets": 32,
26
+ "tie_word_embeddings": false,
27
+ "tokenizer_class": "T5Tokenizer",
28
+ "torch_dtype": "float32",
29
+ "transformers_version": "4.22.1",
30
+ "use_cache": true,
31
+ "vocab_size": 50004
32
+ }
UniPoll-t5/best_model/pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1741c956f991a7ba239b38322657b7780961f9831914604a5adb75297f6f837e
3
+ size 1100236621
UniPoll-t5/best_model/special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
UniPoll-t5/best_model/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "do_basic_tokenize": true,
4
+ "do_lower_case": true,
5
+ "mask_token": "[MASK]",
6
+ "name_or_path": "/root/Documents/CODES/UniPoll/checkpoints/imxly/t5-pegasus",
7
+ "never_split": null,
8
+ "pad_token": "[PAD]",
9
+ "sep_token": "[SEP]",
10
+ "special_tokens_map_file": null,
11
+ "strip_accents": null,
12
+ "tokenize_chinese_chars": true,
13
+ "tokenizer_class": "T5PegasusTokenizer",
14
+ "unk_token": "[UNK]"
15
+ }
UniPoll-t5/best_model/trainer_state.json ADDED
@@ -0,0 +1,1001 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": 49.33,
3
+ "best_model_checkpoint": "outputs/UniPoll-t5/checkpoint-60760",
4
+ "epoch": 10.0,
5
+ "global_step": 60760,
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.08,
12
+ "learning_rate": 2.9753127057274523e-05,
13
+ "loss": 16.5215,
14
+ "step": 500
15
+ },
16
+ {
17
+ "epoch": 0.16,
18
+ "learning_rate": 2.9506254114549046e-05,
19
+ "loss": 3.5706,
20
+ "step": 1000
21
+ },
22
+ {
23
+ "epoch": 0.25,
24
+ "learning_rate": 2.9259381171823572e-05,
25
+ "loss": 2.9107,
26
+ "step": 1500
27
+ },
28
+ {
29
+ "epoch": 0.33,
30
+ "learning_rate": 2.901250822909809e-05,
31
+ "loss": 2.6763,
32
+ "step": 2000
33
+ },
34
+ {
35
+ "epoch": 0.41,
36
+ "learning_rate": 2.8765635286372614e-05,
37
+ "loss": 2.4391,
38
+ "step": 2500
39
+ },
40
+ {
41
+ "epoch": 0.49,
42
+ "learning_rate": 2.8518762343647136e-05,
43
+ "loss": 2.2868,
44
+ "step": 3000
45
+ },
46
+ {
47
+ "epoch": 0.58,
48
+ "learning_rate": 2.827188940092166e-05,
49
+ "loss": 2.2185,
50
+ "step": 3500
51
+ },
52
+ {
53
+ "epoch": 0.66,
54
+ "learning_rate": 2.802501645819618e-05,
55
+ "loss": 2.0841,
56
+ "step": 4000
57
+ },
58
+ {
59
+ "epoch": 0.74,
60
+ "learning_rate": 2.7778143515470708e-05,
61
+ "loss": 2.013,
62
+ "step": 4500
63
+ },
64
+ {
65
+ "epoch": 0.82,
66
+ "learning_rate": 2.7531270572745227e-05,
67
+ "loss": 1.9524,
68
+ "step": 5000
69
+ },
70
+ {
71
+ "epoch": 0.91,
72
+ "learning_rate": 2.728439763001975e-05,
73
+ "loss": 1.9129,
74
+ "step": 5500
75
+ },
76
+ {
77
+ "epoch": 0.99,
78
+ "learning_rate": 2.7037524687294272e-05,
79
+ "loss": 1.8501,
80
+ "step": 6000
81
+ },
82
+ {
83
+ "epoch": 1.0,
84
+ "eval_choices_bleu1": 34.2743,
85
+ "eval_choices_bleu2": 27.071,
86
+ "eval_choices_bleu3": 23.8714,
87
+ "eval_choices_bleu4": 19.9582,
88
+ "eval_choices_rouge1": 43.056,
89
+ "eval_choices_rouge2": 30.797,
90
+ "eval_choices_rougeL": 40.79,
91
+ "eval_choices_rougeLsum": 30.362,
92
+ "eval_loss": 1.7218139171600342,
93
+ "eval_mean_rouge1": 44.783500000000004,
94
+ "eval_runtime": 613.1086,
95
+ "eval_samples_per_second": 3.303,
96
+ "eval_steps_per_second": 0.414,
97
+ "eval_title_bleu1": 39.1598,
98
+ "eval_title_bleu2": 24.8472,
99
+ "eval_title_bleu3": 17.1189,
100
+ "eval_title_bleu4": 11.4654,
101
+ "eval_title_rouge1": 46.511,
102
+ "eval_title_rouge2": 28.336,
103
+ "eval_title_rougeL": 43.814,
104
+ "eval_title_rougeLsum": 28.185,
105
+ "step": 6076
106
+ },
107
+ {
108
+ "epoch": 1.07,
109
+ "learning_rate": 2.6790651744568795e-05,
110
+ "loss": 1.7659,
111
+ "step": 6500
112
+ },
113
+ {
114
+ "epoch": 1.15,
115
+ "learning_rate": 2.654377880184332e-05,
116
+ "loss": 1.7064,
117
+ "step": 7000
118
+ },
119
+ {
120
+ "epoch": 1.23,
121
+ "learning_rate": 2.6296905859117843e-05,
122
+ "loss": 1.6739,
123
+ "step": 7500
124
+ },
125
+ {
126
+ "epoch": 1.32,
127
+ "learning_rate": 2.6050032916392366e-05,
128
+ "loss": 1.6589,
129
+ "step": 8000
130
+ },
131
+ {
132
+ "epoch": 1.4,
133
+ "learning_rate": 2.5803159973666885e-05,
134
+ "loss": 1.6193,
135
+ "step": 8500
136
+ },
137
+ {
138
+ "epoch": 1.48,
139
+ "learning_rate": 2.5556287030941408e-05,
140
+ "loss": 1.6175,
141
+ "step": 9000
142
+ },
143
+ {
144
+ "epoch": 1.56,
145
+ "learning_rate": 2.530941408821593e-05,
146
+ "loss": 1.6042,
147
+ "step": 9500
148
+ },
149
+ {
150
+ "epoch": 1.65,
151
+ "learning_rate": 2.5062541145490456e-05,
152
+ "loss": 1.5438,
153
+ "step": 10000
154
+ },
155
+ {
156
+ "epoch": 1.73,
157
+ "learning_rate": 2.481566820276498e-05,
158
+ "loss": 1.5275,
159
+ "step": 10500
160
+ },
161
+ {
162
+ "epoch": 1.81,
163
+ "learning_rate": 2.45687952600395e-05,
164
+ "loss": 1.5144,
165
+ "step": 11000
166
+ },
167
+ {
168
+ "epoch": 1.89,
169
+ "learning_rate": 2.432192231731402e-05,
170
+ "loss": 1.4911,
171
+ "step": 11500
172
+ },
173
+ {
174
+ "epoch": 1.97,
175
+ "learning_rate": 2.4075049374588544e-05,
176
+ "loss": 1.4301,
177
+ "step": 12000
178
+ },
179
+ {
180
+ "epoch": 2.0,
181
+ "eval_choices_bleu1": 36.2304,
182
+ "eval_choices_bleu2": 29.2436,
183
+ "eval_choices_bleu3": 26.0301,
184
+ "eval_choices_bleu4": 21.8164,
185
+ "eval_choices_rouge1": 45.164,
186
+ "eval_choices_rouge2": 33.104,
187
+ "eval_choices_rougeL": 42.835,
188
+ "eval_choices_rougeLsum": 32.498,
189
+ "eval_loss": 1.6042917966842651,
190
+ "eval_mean_rouge1": 47.2485,
191
+ "eval_runtime": 613.8133,
192
+ "eval_samples_per_second": 3.299,
193
+ "eval_steps_per_second": 0.414,
194
+ "eval_title_bleu1": 41.7754,
195
+ "eval_title_bleu2": 27.1102,
196
+ "eval_title_bleu3": 18.344,
197
+ "eval_title_bleu4": 12.3234,
198
+ "eval_title_rouge1": 49.333,
199
+ "eval_title_rouge2": 30.676,
200
+ "eval_title_rougeL": 46.561,
201
+ "eval_title_rougeLsum": 30.748,
202
+ "step": 12152
203
+ },
204
+ {
205
+ "epoch": 2.06,
206
+ "learning_rate": 2.3828176431863066e-05,
207
+ "loss": 1.4002,
208
+ "step": 12500
209
+ },
210
+ {
211
+ "epoch": 2.14,
212
+ "learning_rate": 2.3581303489137592e-05,
213
+ "loss": 1.3791,
214
+ "step": 13000
215
+ },
216
+ {
217
+ "epoch": 2.22,
218
+ "learning_rate": 2.3334430546412115e-05,
219
+ "loss": 1.3332,
220
+ "step": 13500
221
+ },
222
+ {
223
+ "epoch": 2.3,
224
+ "learning_rate": 2.3087557603686637e-05,
225
+ "loss": 1.3577,
226
+ "step": 14000
227
+ },
228
+ {
229
+ "epoch": 2.39,
230
+ "learning_rate": 2.284068466096116e-05,
231
+ "loss": 1.3483,
232
+ "step": 14500
233
+ },
234
+ {
235
+ "epoch": 2.47,
236
+ "learning_rate": 2.259381171823568e-05,
237
+ "loss": 1.3584,
238
+ "step": 15000
239
+ },
240
+ {
241
+ "epoch": 2.55,
242
+ "learning_rate": 2.2346938775510205e-05,
243
+ "loss": 1.3186,
244
+ "step": 15500
245
+ },
246
+ {
247
+ "epoch": 2.63,
248
+ "learning_rate": 2.2100065832784728e-05,
249
+ "loss": 1.3283,
250
+ "step": 16000
251
+ },
252
+ {
253
+ "epoch": 2.72,
254
+ "learning_rate": 2.185319289005925e-05,
255
+ "loss": 1.2867,
256
+ "step": 16500
257
+ },
258
+ {
259
+ "epoch": 2.8,
260
+ "learning_rate": 2.1606319947333773e-05,
261
+ "loss": 1.2766,
262
+ "step": 17000
263
+ },
264
+ {
265
+ "epoch": 2.88,
266
+ "learning_rate": 2.1359447004608296e-05,
267
+ "loss": 1.3025,
268
+ "step": 17500
269
+ },
270
+ {
271
+ "epoch": 2.96,
272
+ "learning_rate": 2.111257406188282e-05,
273
+ "loss": 1.2736,
274
+ "step": 18000
275
+ },
276
+ {
277
+ "epoch": 3.0,
278
+ "eval_choices_bleu1": 36.9274,
279
+ "eval_choices_bleu2": 30.039,
280
+ "eval_choices_bleu3": 26.4107,
281
+ "eval_choices_bleu4": 22.0831,
282
+ "eval_choices_rouge1": 46.229,
283
+ "eval_choices_rouge2": 33.898,
284
+ "eval_choices_rougeL": 43.746,
285
+ "eval_choices_rougeLsum": 33.141,
286
+ "eval_loss": 1.5690504312515259,
287
+ "eval_mean_rouge1": 48.167500000000004,
288
+ "eval_runtime": 614.3575,
289
+ "eval_samples_per_second": 3.296,
290
+ "eval_steps_per_second": 0.413,
291
+ "eval_title_bleu1": 42.3694,
292
+ "eval_title_bleu2": 28.0839,
293
+ "eval_title_bleu3": 19.3916,
294
+ "eval_title_bleu4": 13.1408,
295
+ "eval_title_rouge1": 50.106,
296
+ "eval_title_rouge2": 31.608,
297
+ "eval_title_rougeL": 47.1,
298
+ "eval_title_rougeLsum": 31.399,
299
+ "step": 18228
300
+ },
301
+ {
302
+ "epoch": 3.04,
303
+ "learning_rate": 2.086570111915734e-05,
304
+ "loss": 1.2176,
305
+ "step": 18500
306
+ },
307
+ {
308
+ "epoch": 3.13,
309
+ "learning_rate": 2.0618828176431864e-05,
310
+ "loss": 1.2037,
311
+ "step": 19000
312
+ },
313
+ {
314
+ "epoch": 3.21,
315
+ "learning_rate": 2.0371955233706386e-05,
316
+ "loss": 1.2104,
317
+ "step": 19500
318
+ },
319
+ {
320
+ "epoch": 3.29,
321
+ "learning_rate": 2.012508229098091e-05,
322
+ "loss": 1.1522,
323
+ "step": 20000
324
+ },
325
+ {
326
+ "epoch": 3.37,
327
+ "learning_rate": 1.987820934825543e-05,
328
+ "loss": 1.1969,
329
+ "step": 20500
330
+ },
331
+ {
332
+ "epoch": 3.46,
333
+ "learning_rate": 1.9631336405529957e-05,
334
+ "loss": 1.1861,
335
+ "step": 21000
336
+ },
337
+ {
338
+ "epoch": 3.54,
339
+ "learning_rate": 1.9384463462804477e-05,
340
+ "loss": 1.1536,
341
+ "step": 21500
342
+ },
343
+ {
344
+ "epoch": 3.62,
345
+ "learning_rate": 1.9137590520079e-05,
346
+ "loss": 1.1394,
347
+ "step": 22000
348
+ },
349
+ {
350
+ "epoch": 3.7,
351
+ "learning_rate": 1.8890717577353522e-05,
352
+ "loss": 1.1229,
353
+ "step": 22500
354
+ },
355
+ {
356
+ "epoch": 3.79,
357
+ "learning_rate": 1.8643844634628044e-05,
358
+ "loss": 1.1233,
359
+ "step": 23000
360
+ },
361
+ {
362
+ "epoch": 3.87,
363
+ "learning_rate": 1.8396971691902567e-05,
364
+ "loss": 1.1265,
365
+ "step": 23500
366
+ },
367
+ {
368
+ "epoch": 3.95,
369
+ "learning_rate": 1.8150098749177093e-05,
370
+ "loss": 1.1438,
371
+ "step": 24000
372
+ },
373
+ {
374
+ "epoch": 4.0,
375
+ "eval_choices_bleu1": 38.2715,
376
+ "eval_choices_bleu2": 30.7803,
377
+ "eval_choices_bleu3": 26.9954,
378
+ "eval_choices_bleu4": 22.6626,
379
+ "eval_choices_rouge1": 46.767,
380
+ "eval_choices_rouge2": 34.301,
381
+ "eval_choices_rougeL": 44.062,
382
+ "eval_choices_rougeLsum": 33.605,
383
+ "eval_loss": 1.5627468824386597,
384
+ "eval_mean_rouge1": 48.6515,
385
+ "eval_runtime": 625.5501,
386
+ "eval_samples_per_second": 3.237,
387
+ "eval_steps_per_second": 0.406,
388
+ "eval_title_bleu1": 42.7056,
389
+ "eval_title_bleu2": 28.0993,
390
+ "eval_title_bleu3": 19.498,
391
+ "eval_title_bleu4": 12.7399,
392
+ "eval_title_rouge1": 50.536,
393
+ "eval_title_rouge2": 31.852,
394
+ "eval_title_rougeL": 47.453,
395
+ "eval_title_rougeLsum": 31.678,
396
+ "step": 24304
397
+ },
398
+ {
399
+ "epoch": 4.03,
400
+ "learning_rate": 1.7903225806451616e-05,
401
+ "loss": 1.0962,
402
+ "step": 24500
403
+ },
404
+ {
405
+ "epoch": 4.11,
406
+ "learning_rate": 1.7656352863726135e-05,
407
+ "loss": 1.0664,
408
+ "step": 25000
409
+ },
410
+ {
411
+ "epoch": 4.2,
412
+ "learning_rate": 1.7409479921000658e-05,
413
+ "loss": 1.0874,
414
+ "step": 25500
415
+ },
416
+ {
417
+ "epoch": 4.28,
418
+ "learning_rate": 1.716260697827518e-05,
419
+ "loss": 1.0608,
420
+ "step": 26000
421
+ },
422
+ {
423
+ "epoch": 4.36,
424
+ "learning_rate": 1.6915734035549703e-05,
425
+ "loss": 1.0367,
426
+ "step": 26500
427
+ },
428
+ {
429
+ "epoch": 4.44,
430
+ "learning_rate": 1.666886109282423e-05,
431
+ "loss": 1.0397,
432
+ "step": 27000
433
+ },
434
+ {
435
+ "epoch": 4.53,
436
+ "learning_rate": 1.642198815009875e-05,
437
+ "loss": 1.0378,
438
+ "step": 27500
439
+ },
440
+ {
441
+ "epoch": 4.61,
442
+ "learning_rate": 1.617511520737327e-05,
443
+ "loss": 1.0143,
444
+ "step": 28000
445
+ },
446
+ {
447
+ "epoch": 4.69,
448
+ "learning_rate": 1.5928242264647793e-05,
449
+ "loss": 1.0186,
450
+ "step": 28500
451
+ },
452
+ {
453
+ "epoch": 4.77,
454
+ "learning_rate": 1.5681369321922316e-05,
455
+ "loss": 1.0243,
456
+ "step": 29000
457
+ },
458
+ {
459
+ "epoch": 4.86,
460
+ "learning_rate": 1.5434496379196842e-05,
461
+ "loss": 1.038,
462
+ "step": 29500
463
+ },
464
+ {
465
+ "epoch": 4.94,
466
+ "learning_rate": 1.5187623436471364e-05,
467
+ "loss": 1.0026,
468
+ "step": 30000
469
+ },
470
+ {
471
+ "epoch": 5.0,
472
+ "eval_choices_bleu1": 37.513,
473
+ "eval_choices_bleu2": 30.5119,
474
+ "eval_choices_bleu3": 26.8236,
475
+ "eval_choices_bleu4": 22.3797,
476
+ "eval_choices_rouge1": 46.999,
477
+ "eval_choices_rouge2": 34.451,
478
+ "eval_choices_rougeL": 44.427,
479
+ "eval_choices_rougeLsum": 33.652,
480
+ "eval_loss": 1.5795127153396606,
481
+ "eval_mean_rouge1": 48.658500000000004,
482
+ "eval_runtime": 619.9047,
483
+ "eval_samples_per_second": 3.267,
484
+ "eval_steps_per_second": 0.41,
485
+ "eval_title_bleu1": 42.3561,
486
+ "eval_title_bleu2": 27.804,
487
+ "eval_title_bleu3": 19.0851,
488
+ "eval_title_bleu4": 12.6803,
489
+ "eval_title_rouge1": 50.318,
490
+ "eval_title_rouge2": 31.494,
491
+ "eval_title_rougeL": 47.297,
492
+ "eval_title_rougeLsum": 31.461,
493
+ "step": 30380
494
+ },
495
+ {
496
+ "epoch": 5.02,
497
+ "learning_rate": 1.4940750493745885e-05,
498
+ "loss": 1.0107,
499
+ "step": 30500
500
+ },
501
+ {
502
+ "epoch": 5.1,
503
+ "learning_rate": 1.4693877551020408e-05,
504
+ "loss": 0.9664,
505
+ "step": 31000
506
+ },
507
+ {
508
+ "epoch": 5.18,
509
+ "learning_rate": 1.4447004608294932e-05,
510
+ "loss": 0.9342,
511
+ "step": 31500
512
+ },
513
+ {
514
+ "epoch": 5.27,
515
+ "learning_rate": 1.4200131665569453e-05,
516
+ "loss": 0.9632,
517
+ "step": 32000
518
+ },
519
+ {
520
+ "epoch": 5.35,
521
+ "learning_rate": 1.3953258722843976e-05,
522
+ "loss": 0.9448,
523
+ "step": 32500
524
+ },
525
+ {
526
+ "epoch": 5.43,
527
+ "learning_rate": 1.37063857801185e-05,
528
+ "loss": 0.9669,
529
+ "step": 33000
530
+ },
531
+ {
532
+ "epoch": 5.51,
533
+ "learning_rate": 1.3459512837393023e-05,
534
+ "loss": 0.9361,
535
+ "step": 33500
536
+ },
537
+ {
538
+ "epoch": 5.6,
539
+ "learning_rate": 1.3212639894667544e-05,
540
+ "loss": 0.9445,
541
+ "step": 34000
542
+ },
543
+ {
544
+ "epoch": 5.68,
545
+ "learning_rate": 1.2965766951942068e-05,
546
+ "loss": 0.9515,
547
+ "step": 34500
548
+ },
549
+ {
550
+ "epoch": 5.76,
551
+ "learning_rate": 1.271889400921659e-05,
552
+ "loss": 0.9488,
553
+ "step": 35000
554
+ },
555
+ {
556
+ "epoch": 5.84,
557
+ "learning_rate": 1.2472021066491112e-05,
558
+ "loss": 0.9145,
559
+ "step": 35500
560
+ },
561
+ {
562
+ "epoch": 5.92,
563
+ "learning_rate": 1.2225148123765636e-05,
564
+ "loss": 0.9493,
565
+ "step": 36000
566
+ },
567
+ {
568
+ "epoch": 6.0,
569
+ "eval_choices_bleu1": 38.7421,
570
+ "eval_choices_bleu2": 31.1954,
571
+ "eval_choices_bleu3": 27.0903,
572
+ "eval_choices_bleu4": 22.4639,
573
+ "eval_choices_rouge1": 47.617,
574
+ "eval_choices_rouge2": 34.86,
575
+ "eval_choices_rougeL": 44.679,
576
+ "eval_choices_rougeLsum": 34.003,
577
+ "eval_loss": 1.5864702463150024,
578
+ "eval_mean_rouge1": 48.966499999999996,
579
+ "eval_runtime": 615.3469,
580
+ "eval_samples_per_second": 3.291,
581
+ "eval_steps_per_second": 0.413,
582
+ "eval_title_bleu1": 42.4031,
583
+ "eval_title_bleu2": 28.2011,
584
+ "eval_title_bleu3": 19.3663,
585
+ "eval_title_bleu4": 12.8818,
586
+ "eval_title_rouge1": 50.316,
587
+ "eval_title_rouge2": 31.841,
588
+ "eval_title_rougeL": 47.179,
589
+ "eval_title_rougeLsum": 31.509,
590
+ "step": 36456
591
+ },
592
+ {
593
+ "epoch": 6.01,
594
+ "learning_rate": 1.1978275181040158e-05,
595
+ "loss": 0.9359,
596
+ "step": 36500
597
+ },
598
+ {
599
+ "epoch": 6.09,
600
+ "learning_rate": 1.1731402238314681e-05,
601
+ "loss": 0.9096,
602
+ "step": 37000
603
+ },
604
+ {
605
+ "epoch": 6.17,
606
+ "learning_rate": 1.1484529295589204e-05,
607
+ "loss": 0.9069,
608
+ "step": 37500
609
+ },
610
+ {
611
+ "epoch": 6.25,
612
+ "learning_rate": 1.1237656352863726e-05,
613
+ "loss": 0.89,
614
+ "step": 38000
615
+ },
616
+ {
617
+ "epoch": 6.34,
618
+ "learning_rate": 1.099078341013825e-05,
619
+ "loss": 0.8761,
620
+ "step": 38500
621
+ },
622
+ {
623
+ "epoch": 6.42,
624
+ "learning_rate": 1.0743910467412772e-05,
625
+ "loss": 0.8919,
626
+ "step": 39000
627
+ },
628
+ {
629
+ "epoch": 6.5,
630
+ "learning_rate": 1.0497037524687294e-05,
631
+ "loss": 0.8869,
632
+ "step": 39500
633
+ },
634
+ {
635
+ "epoch": 6.58,
636
+ "learning_rate": 1.0250164581961818e-05,
637
+ "loss": 0.8912,
638
+ "step": 40000
639
+ },
640
+ {
641
+ "epoch": 6.67,
642
+ "learning_rate": 1.000329163923634e-05,
643
+ "loss": 0.8885,
644
+ "step": 40500
645
+ },
646
+ {
647
+ "epoch": 6.75,
648
+ "learning_rate": 9.756418696510862e-06,
649
+ "loss": 0.8691,
650
+ "step": 41000
651
+ },
652
+ {
653
+ "epoch": 6.83,
654
+ "learning_rate": 9.509545753785386e-06,
655
+ "loss": 0.8882,
656
+ "step": 41500
657
+ },
658
+ {
659
+ "epoch": 6.91,
660
+ "learning_rate": 9.262672811059907e-06,
661
+ "loss": 0.8822,
662
+ "step": 42000
663
+ },
664
+ {
665
+ "epoch": 6.99,
666
+ "learning_rate": 9.01579986833443e-06,
667
+ "loss": 0.8622,
668
+ "step": 42500
669
+ },
670
+ {
671
+ "epoch": 7.0,
672
+ "eval_choices_bleu1": 38.5191,
673
+ "eval_choices_bleu2": 31.1743,
674
+ "eval_choices_bleu3": 27.2188,
675
+ "eval_choices_bleu4": 22.5257,
676
+ "eval_choices_rouge1": 47.345,
677
+ "eval_choices_rouge2": 34.733,
678
+ "eval_choices_rougeL": 44.637,
679
+ "eval_choices_rougeLsum": 33.956,
680
+ "eval_loss": 1.6173765659332275,
681
+ "eval_mean_rouge1": 49.0085,
682
+ "eval_runtime": 624.2904,
683
+ "eval_samples_per_second": 3.244,
684
+ "eval_steps_per_second": 0.407,
685
+ "eval_title_bleu1": 42.7395,
686
+ "eval_title_bleu2": 28.2813,
687
+ "eval_title_bleu3": 19.4836,
688
+ "eval_title_bleu4": 12.7587,
689
+ "eval_title_rouge1": 50.672,
690
+ "eval_title_rouge2": 32.013,
691
+ "eval_title_rougeL": 47.817,
692
+ "eval_title_rougeLsum": 31.899,
693
+ "step": 42532
694
+ },
695
+ {
696
+ "epoch": 7.08,
697
+ "learning_rate": 8.768926925608954e-06,
698
+ "loss": 0.8468,
699
+ "step": 43000
700
+ },
701
+ {
702
+ "epoch": 7.16,
703
+ "learning_rate": 8.522053982883475e-06,
704
+ "loss": 0.8209,
705
+ "step": 43500
706
+ },
707
+ {
708
+ "epoch": 7.24,
709
+ "learning_rate": 8.275181040158e-06,
710
+ "loss": 0.8379,
711
+ "step": 44000
712
+ },
713
+ {
714
+ "epoch": 7.32,
715
+ "learning_rate": 8.028308097432522e-06,
716
+ "loss": 0.8544,
717
+ "step": 44500
718
+ },
719
+ {
720
+ "epoch": 7.41,
721
+ "learning_rate": 7.781435154707045e-06,
722
+ "loss": 0.8394,
723
+ "step": 45000
724
+ },
725
+ {
726
+ "epoch": 7.49,
727
+ "learning_rate": 7.534562211981568e-06,
728
+ "loss": 0.8285,
729
+ "step": 45500
730
+ },
731
+ {
732
+ "epoch": 7.57,
733
+ "learning_rate": 7.28768926925609e-06,
734
+ "loss": 0.8333,
735
+ "step": 46000
736
+ },
737
+ {
738
+ "epoch": 7.65,
739
+ "learning_rate": 7.0408163265306125e-06,
740
+ "loss": 0.8359,
741
+ "step": 46500
742
+ },
743
+ {
744
+ "epoch": 7.74,
745
+ "learning_rate": 6.793943383805135e-06,
746
+ "loss": 0.8176,
747
+ "step": 47000
748
+ },
749
+ {
750
+ "epoch": 7.82,
751
+ "learning_rate": 6.547070441079658e-06,
752
+ "loss": 0.842,
753
+ "step": 47500
754
+ },
755
+ {
756
+ "epoch": 7.9,
757
+ "learning_rate": 6.30019749835418e-06,
758
+ "loss": 0.8351,
759
+ "step": 48000
760
+ },
761
+ {
762
+ "epoch": 7.98,
763
+ "learning_rate": 6.053324555628703e-06,
764
+ "loss": 0.8367,
765
+ "step": 48500
766
+ },
767
+ {
768
+ "epoch": 8.0,
769
+ "eval_choices_bleu1": 38.7622,
770
+ "eval_choices_bleu2": 31.0867,
771
+ "eval_choices_bleu3": 26.9654,
772
+ "eval_choices_bleu4": 22.4556,
773
+ "eval_choices_rouge1": 47.531,
774
+ "eval_choices_rouge2": 34.756,
775
+ "eval_choices_rougeL": 44.649,
776
+ "eval_choices_rougeLsum": 33.959,
777
+ "eval_loss": 1.6293848752975464,
778
+ "eval_mean_rouge1": 49.2605,
779
+ "eval_runtime": 622.1469,
780
+ "eval_samples_per_second": 3.255,
781
+ "eval_steps_per_second": 0.408,
782
+ "eval_title_bleu1": 43.0901,
783
+ "eval_title_bleu2": 28.6471,
784
+ "eval_title_bleu3": 19.7616,
785
+ "eval_title_bleu4": 12.9726,
786
+ "eval_title_rouge1": 50.99,
787
+ "eval_title_rouge2": 32.44,
788
+ "eval_title_rougeL": 47.948,
789
+ "eval_title_rougeLsum": 32.24,
790
+ "step": 48608
791
+ },
792
+ {
793
+ "epoch": 8.06,
794
+ "learning_rate": 5.8064516129032256e-06,
795
+ "loss": 0.8004,
796
+ "step": 49000
797
+ },
798
+ {
799
+ "epoch": 8.15,
800
+ "learning_rate": 5.559578670177749e-06,
801
+ "loss": 0.789,
802
+ "step": 49500
803
+ },
804
+ {
805
+ "epoch": 8.23,
806
+ "learning_rate": 5.312705727452272e-06,
807
+ "loss": 0.7843,
808
+ "step": 50000
809
+ },
810
+ {
811
+ "epoch": 8.31,
812
+ "learning_rate": 5.065832784726793e-06,
813
+ "loss": 0.8102,
814
+ "step": 50500
815
+ },
816
+ {
817
+ "epoch": 8.39,
818
+ "learning_rate": 4.818959842001317e-06,
819
+ "loss": 0.7979,
820
+ "step": 51000
821
+ },
822
+ {
823
+ "epoch": 8.48,
824
+ "learning_rate": 4.5720868992758395e-06,
825
+ "loss": 0.8262,
826
+ "step": 51500
827
+ },
828
+ {
829
+ "epoch": 8.56,
830
+ "learning_rate": 4.325213956550362e-06,
831
+ "loss": 0.8149,
832
+ "step": 52000
833
+ },
834
+ {
835
+ "epoch": 8.64,
836
+ "learning_rate": 4.078341013824885e-06,
837
+ "loss": 0.8178,
838
+ "step": 52500
839
+ },
840
+ {
841
+ "epoch": 8.72,
842
+ "learning_rate": 3.831468071099407e-06,
843
+ "loss": 0.7796,
844
+ "step": 53000
845
+ },
846
+ {
847
+ "epoch": 8.81,
848
+ "learning_rate": 3.5845951283739304e-06,
849
+ "loss": 0.8036,
850
+ "step": 53500
851
+ },
852
+ {
853
+ "epoch": 8.89,
854
+ "learning_rate": 3.337722185648453e-06,
855
+ "loss": 0.8169,
856
+ "step": 54000
857
+ },
858
+ {
859
+ "epoch": 8.97,
860
+ "learning_rate": 3.0908492429229756e-06,
861
+ "loss": 0.8138,
862
+ "step": 54500
863
+ },
864
+ {
865
+ "epoch": 9.0,
866
+ "eval_choices_bleu1": 38.8037,
867
+ "eval_choices_bleu2": 31.1809,
868
+ "eval_choices_bleu3": 27.0585,
869
+ "eval_choices_bleu4": 22.3774,
870
+ "eval_choices_rouge1": 47.629,
871
+ "eval_choices_rouge2": 34.778,
872
+ "eval_choices_rougeL": 44.722,
873
+ "eval_choices_rougeLsum": 33.944,
874
+ "eval_loss": 1.6443856954574585,
875
+ "eval_mean_rouge1": 49.32,
876
+ "eval_runtime": 624.8802,
877
+ "eval_samples_per_second": 3.241,
878
+ "eval_steps_per_second": 0.406,
879
+ "eval_title_bleu1": 43.0453,
880
+ "eval_title_bleu2": 28.6763,
881
+ "eval_title_bleu3": 19.7491,
882
+ "eval_title_bleu4": 13.004,
883
+ "eval_title_rouge1": 51.011,
884
+ "eval_title_rouge2": 32.398,
885
+ "eval_title_rougeL": 47.974,
886
+ "eval_title_rougeLsum": 32.251,
887
+ "step": 54684
888
+ },
889
+ {
890
+ "epoch": 9.05,
891
+ "learning_rate": 2.8439763001974987e-06,
892
+ "loss": 0.7764,
893
+ "step": 55000
894
+ },
895
+ {
896
+ "epoch": 9.13,
897
+ "learning_rate": 2.5971033574720213e-06,
898
+ "loss": 0.7939,
899
+ "step": 55500
900
+ },
901
+ {
902
+ "epoch": 9.22,
903
+ "learning_rate": 2.3502304147465435e-06,
904
+ "loss": 0.8069,
905
+ "step": 56000
906
+ },
907
+ {
908
+ "epoch": 9.3,
909
+ "learning_rate": 2.1033574720210665e-06,
910
+ "loss": 0.7649,
911
+ "step": 56500
912
+ },
913
+ {
914
+ "epoch": 9.38,
915
+ "learning_rate": 1.8564845292955893e-06,
916
+ "loss": 0.7977,
917
+ "step": 57000
918
+ },
919
+ {
920
+ "epoch": 9.46,
921
+ "learning_rate": 1.609611586570112e-06,
922
+ "loss": 0.803,
923
+ "step": 57500
924
+ },
925
+ {
926
+ "epoch": 9.55,
927
+ "learning_rate": 1.3627386438446346e-06,
928
+ "loss": 0.7813,
929
+ "step": 58000
930
+ },
931
+ {
932
+ "epoch": 9.63,
933
+ "learning_rate": 1.1158657011191574e-06,
934
+ "loss": 0.7645,
935
+ "step": 58500
936
+ },
937
+ {
938
+ "epoch": 9.71,
939
+ "learning_rate": 8.689927583936801e-07,
940
+ "loss": 0.7865,
941
+ "step": 59000
942
+ },
943
+ {
944
+ "epoch": 9.79,
945
+ "learning_rate": 6.221198156682028e-07,
946
+ "loss": 0.7818,
947
+ "step": 59500
948
+ },
949
+ {
950
+ "epoch": 9.87,
951
+ "learning_rate": 3.752468729427255e-07,
952
+ "loss": 0.7572,
953
+ "step": 60000
954
+ },
955
+ {
956
+ "epoch": 9.96,
957
+ "learning_rate": 1.283739302172482e-07,
958
+ "loss": 0.7788,
959
+ "step": 60500
960
+ },
961
+ {
962
+ "epoch": 10.0,
963
+ "eval_choices_bleu1": 38.8515,
964
+ "eval_choices_bleu2": 31.2992,
965
+ "eval_choices_bleu3": 27.2073,
966
+ "eval_choices_bleu4": 22.4633,
967
+ "eval_choices_rouge1": 47.688,
968
+ "eval_choices_rouge2": 34.913,
969
+ "eval_choices_rougeL": 44.77,
970
+ "eval_choices_rougeLsum": 34.038,
971
+ "eval_loss": 1.6531261205673218,
972
+ "eval_mean_rouge1": 49.33,
973
+ "eval_runtime": 620.225,
974
+ "eval_samples_per_second": 3.265,
975
+ "eval_steps_per_second": 0.41,
976
+ "eval_title_bleu1": 43.0602,
977
+ "eval_title_bleu2": 28.6495,
978
+ "eval_title_bleu3": 19.8146,
979
+ "eval_title_bleu4": 13.144,
980
+ "eval_title_rouge1": 50.972,
981
+ "eval_title_rouge2": 32.375,
982
+ "eval_title_rougeL": 47.919,
983
+ "eval_title_rougeLsum": 32.201,
984
+ "step": 60760
985
+ },
986
+ {
987
+ "epoch": 10.0,
988
+ "step": 60760,
989
+ "total_flos": 1.262557342857001e+17,
990
+ "train_loss": 1.288209796626761,
991
+ "train_runtime": 17551.2786,
992
+ "train_samples_per_second": 27.692,
993
+ "train_steps_per_second": 3.462
994
+ }
995
+ ],
996
+ "max_steps": 60760,
997
+ "num_train_epochs": 10,
998
+ "total_flos": 1.262557342857001e+17,
999
+ "trial_name": null,
1000
+ "trial_params": null
1001
+ }
UniPoll-t5/best_model/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53d331e9447f18c1699297a18369f397bdf5607c47ff32a23a2d6d9c4d795179
3
+ size 3503
UniPoll-t5/best_model/vocab.txt ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gc
2
+ import sys
3
+ import torch
4
+ import argparse
5
+ import gradio as gr
6
+ from typing import List, Tuple
7
+ from transformers import AutoConfig
8
+ from transformers.models.mt5.modeling_mt5 import MT5ForConditionalGeneration
9
+ from utils import T5PegasusTokenizer
10
+
11
+ try:
12
+ from loguru import logger as logging
13
+ logging.add(sys.stderr, filter="my_module")
14
+ except ImportError:
15
+ import logging
16
+
17
+ import time
18
+ class TimerDecorator:
19
+ def __init__(self, func) :
20
+ self.func = func
21
+
22
+ def __call__(self, *args, **kwargs) :
23
+ start_time = time.time()
24
+ result = self.func(*args, **kwargs)
25
+ end_time = time.time()
26
+ t = end_time - start_time
27
+ logging.info(f"Function `{self.func.__name__}` took {round(t, 2)} s to run.")
28
+ return result
29
+
30
+ @TimerDecorator
31
+ def load_model(model_path, device="cpu"):
32
+ logging.info(f"Loading model from {model_path}")
33
+ config = AutoConfig.from_pretrained(model_path)
34
+ tokenizer = T5PegasusTokenizer.from_pretrained(model_path)
35
+ model = MT5ForConditionalGeneration.from_pretrained(model_path, config=config)
36
+ if device != "cpu":
37
+ model.to(device)
38
+ logging.info("Done.")
39
+ return model, tokenizer
40
+
41
+ def wrap_prompt(
42
+ post, comments,
43
+ prompt="生成 <title> 和 <choices>: [SEP] {post} [SEP] {comments}"
44
+ ):
45
+ if not comments or comments == "":
46
+ logging.info("No comments input, comments will be ignored.")
47
+ prompt = prompt.replace(" [SEP] {comments}", "")
48
+ prompt = prompt.format(post=post)
49
+ else:
50
+ prompt = prompt.format(post=post, comments=comments)
51
+ logging.info(f"Wrapped prompt: {prompt}")
52
+ return prompt
53
+
54
+ @TimerDecorator
55
+ def generate(query, model, tokenizer, num_beams=4, device="cpu"):
56
+ logging.info("Generating output...")
57
+ tokens = tokenizer(query, return_tensors="pt")["input_ids"]
58
+ if device != "cpu":
59
+ tokens = tokens.to(device)
60
+ output = model.generate(tokens, num_beams=num_beams, max_length=100)
61
+ output_text = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
62
+ logging.info("Done.")
63
+ return output_text
64
+
65
+ def post_process(raw_output: str) -> Tuple[str, str]:
66
+ def same_title_choices(raw_output):
67
+ # return the same raw output as title and choices
68
+ # if no <title> or <choices> in raw_output
69
+ raw_output = raw_output.replace("<title>", "")
70
+ raw_output = raw_output.replace("<choices>", "")
71
+ return raw_output.strip(), [raw_output.strip()]
72
+
73
+ def split_choices(choices_str: str) -> List[str]:
74
+ choices = choices_str.split("<c>")
75
+ choices = [choice.strip() for choice in choices]
76
+ return choices
77
+
78
+ # extract title and choices from raw_output
79
+ # e.g. raw_output = "<title> 你 觉得 线 上 复试 公平 吗 <choices> 公平 <c> 不 公平"
80
+ if "<title>" in raw_output and "<choices>" in raw_output:
81
+ index1 = raw_output.index("<title>")
82
+ index2 = raw_output.index("<choices>")
83
+ if index1 > index2:
84
+ logging.debug(f"idx1>idx2, same title and choices will be used.\nraw_output: {raw_output}")
85
+ return same_title_choices(raw_output)
86
+ title = raw_output[index1+7: index2].strip() # "你 觉得 线 上 复试 公平 吗"
87
+ choices_str = raw_output[index2+9:].strip() # "公平 <c> 不 公平"
88
+ choices = split_choices(choices_str) # ["公平", "不 公平"]
89
+ else:
90
+ logging.debug(f"missing title/choices, same title and choices will be used.\nraw_output: {raw_output}")
91
+ title, choices = same_title_choices(raw_output)
92
+
93
+ def remove_blank(string):
94
+ return string.replace(" ", "")
95
+
96
+ title = remove_blank(title)
97
+ choices = [remove_blank(choice) for choice in choices]
98
+ return title, choices
99
+
100
+ def parse_args():
101
+ parser = argparse.ArgumentParser(description="Demo")
102
+ parser.add_argument("--model_path", type=str, default="./UniPoll-t5/best_model", help="path to the model.")
103
+ parser.add_argument("--device", type=str, default="cpu", help="specify the device to load the model, e.g. 'cpu', 'cuda:0'.")
104
+ parser.add_argument(
105
+ "--options",
106
+ nargs="+",
107
+ help="override some settings in the used config, the key-value pair "
108
+ "in xxx=yyy format will be merged into config file (deprecate), "
109
+ "change to --cfg-options instead.",
110
+ )
111
+ args = parser.parse_args()
112
+ return args
113
+
114
+
115
+ if __name__ == "__main__":
116
+ args = parse_args()
117
+
118
+ logging.info('Initializing Model...')
119
+ # prepare the model
120
+ model, tokenizer = load_model(args.model_path, args.device)
121
+
122
+ def submit(post, comments, num_beams):
123
+ try:
124
+ logging.info("Received post input: {}".format(post))
125
+ if comments:
126
+ logging.info("Received comments input: {}".format(comments))
127
+
128
+ query = wrap_prompt(post, comments)
129
+ raw_output = generate(
130
+ query, model, tokenizer, num_beams, args.device)
131
+ title, choices = post_process(raw_output) # post process
132
+ logging.info(f"Raw output: {raw_output}")
133
+ logging.info(f"Processed title: {title}")
134
+ logging.info(f"Processed choices: {choices}")
135
+ # return title, choices, raw_output
136
+ return title, choices
137
+ except Exception as e:
138
+ return "An error occurred: {}".format(str(e)), "An error occurred: {}".format(str(e))
139
+ finally:
140
+ gc.collect()
141
+ torch.cuda.empty_cache()
142
+
143
+ examples = [
144
+ ["#哪吒,大鱼海棠重映#动画电影《哪吒之魔童降世》、《大鱼海棠》,以及雷佳音、佟丽娅主演的 《超时空同居》确定将重映。据最新数据显示,3月24日全国复工影院495家,复工率4.36%,单日票房2.7万元。", "我在人间贩卖黄昏,只为收集世间温柔,去见你。谢谢你的分享,来看看你。我的微博,随时恭候你的到..."],
145
+ ["#线上复试是否能保障公平# 高考延期惹的祸,考研线上复试,那还能保证公平吗?", "这个世界上本来就没有绝对的公平。你可以说一个倒数第一考了第一,但考上了他也还是啥都不会。也可以说他会利用一切机会达到目的,反正结果就是人家考的好,你还找不出来证据。线上考试,平时考倒数的人进了年级前十。平时考试有水分,线上之后,那不就是在水里考?"],
146
+ ["#断亲现象为何如此流行#?所谓“断亲”指的是当代年轻人懒于、疏于、不屑于跟亲戚交往、联系、互动,日常音信全无,哪怕在逢年过节期间,宁可独来独往,也不愿意走亲戚,甚至将此作为一种时尚生活方式来推崇。", ""]
147
+ ]
148
+
149
+ description = """This is the demo of UniPoll. Please input post and comments. <div style='display:flex; gap: 0.25rem; '><a href='https://uni-poll.github.io'><img src='https://img.shields.io/badge/Project-Page-Green'></a><a href='https://github.com/X1AOX1A/UniPoll'><img src='https://img.shields.io/badge/Github-Code-blue'></a><a href='https://arxiv.org/abs/2306.06851'><img src='https://img.shields.io/badge/Paper-PDF-red'></a></div>
150
+ """
151
+
152
+ demo = gr.Interface(
153
+ fn=submit,
154
+ inputs=[gr.Textbox(lines=1, label="Social Media Post", placeholder="Input post here..."),
155
+ gr.Textbox(lines=1, label="Social Media Comments (Optional)", placeholder="Input comments here..."),
156
+ gr.Number(value=4, label="Number of Beams", precision=0),
157
+ ],
158
+ outputs=[gr.Textbox(lines=1, label="Generated Poll Question", placeholder="Generated poll question will be shown here"),
159
+ gr.Textbox(lines=1, label="Generated Poll Choices", placeholder="Generated poll choices will be shown here"),
160
+ ], # question, choices
161
+ title="Demo of UniPoll",
162
+ description=description,
163
+ allow_flagging="never",
164
+ examples=examples,
165
+ )
166
+
167
+ demo.queue(max_size=10)
168
+ demo.launch(share=True, show_error=True)
169
+
170
+ # python app.py --model_path "./UniPoll-t5/best_model" --device "cpu"
requirements.txt ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==1.4.0
2
+ aiofiles==23.2.1
3
+ alabaster @ file:///home/ktietz/src/ci/alabaster_1611921544520/work
4
+ altair==5.0.1
5
+ anaconda-client==1.11.0
6
+ anaconda-navigator==2.3.1
7
+ anaconda-project @ file:///opt/conda/conda-bld/anaconda-project_1660339890420/work
8
+ annotated-types==0.5.0
9
+ antlr4-python3-runtime==4.8
10
+ anyio==3.7.1
11
+ appdirs==1.4.4
12
+ argon2-cffi @ file:///opt/conda/conda-bld/argon2-cffi_1645000214183/work
13
+ argon2-cffi-bindings @ file:///tmp/build/80754af9/argon2-cffi-bindings_1644569679365/work
14
+ arrow @ file:///opt/conda/conda-bld/arrow_1649166651673/work
15
+ astroid @ file:///tmp/abs_e5wkt48jiz/croots/recipe/astroid_1659023120113/work
16
+ astropy @ file:///opt/conda/conda-bld/astropy_1657786094003/work
17
+ astunparse==1.6.3
18
+ atomicwrites==1.4.0
19
+ attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
20
+ Automat @ file:///tmp/build/80754af9/automat_1600298431173/work
21
+ autopep8 @ file:///opt/conda/conda-bld/autopep8_1650463822033/work
22
+ Babel @ file:///tmp/build/80754af9/babel_1620871417480/work
23
+ backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work
24
+ backports.functools-lru-cache @ file:///tmp/build/80754af9/backports.functools_lru_cache_1618170165463/work
25
+ backports.tempfile @ file:///home/linux1/recipes/ci/backports.tempfile_1610991236607/work
26
+ backports.weakref==1.0.post1
27
+ bcrypt @ file:///tmp/abs_6fpe92qzzo/croots/recipe/bcrypt_1659554336150/work
28
+ beautifulsoup4 @ file:///opt/conda/conda-bld/beautifulsoup4_1650462163268/work
29
+ binaryornot @ file:///tmp/build/80754af9/binaryornot_1617751525010/work
30
+ bitarray @ file:///opt/conda/conda-bld/bitarray_1657739645104/work
31
+ bkcharts==0.2
32
+ black @ file:///opt/conda/conda-bld/black_1660237809219/work
33
+ bleach @ file:///opt/conda/conda-bld/bleach_1641577558959/work
34
+ blinker==1.6.2
35
+ bokeh @ file:///tmp/abs_34854e1f-d7d3-4f22-85d9-1075588e4ecdga64o0qg/croots/recipe/bokeh_1658136654619/work
36
+ boto3 @ file:///tmp/abs_ae3c72db-af47-4298-baea-7270430e2c96scbpg1_h/croots/recipe/boto3_1657820109150/work
37
+ botocore @ file:///opt/conda/conda-bld/botocore_1657739486257/work
38
+ Bottleneck @ file:///opt/conda/conda-bld/bottleneck_1657175564434/work
39
+ brotlipy==0.7.0
40
+ cachetools==5.3.0
41
+ certifi @ file:///opt/conda/conda-bld/certifi_1663615672595/work/certifi
42
+ cffi @ file:///tmp/abs_98z5h56wf8/croots/recipe/cffi_1659598650955/work
43
+ chardet @ file:///tmp/build/80754af9/chardet_1607706775000/work
44
+ charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work
45
+ click @ file:///tmp/build/80754af9/click_1646056590078/work
46
+ cloudpickle @ file:///tmp/build/80754af9/cloudpickle_1632508026186/work
47
+ clyent==1.2.2
48
+ cmake==3.26.3
49
+ colorama @ file:///opt/conda/conda-bld/colorama_1657009087971/work
50
+ colorcet @ file:///tmp/build/80754af9/colorcet_1651851439427/work
51
+ conda==23.1.0
52
+ conda-build==3.22.0
53
+ conda-content-trust @ file:///tmp/abs_5952f1c8-355c-4855-ad2e-538535021ba5h26t22e5/croots/recipe/conda-content-trust_1658126371814/work
54
+ conda-pack @ file:///tmp/build/80754af9/conda-pack_1611163042455/work
55
+ conda-package-handling @ file:///opt/conda/conda-bld/conda-package-handling_1663598473529/work
56
+ conda-repo-cli==1.0.20
57
+ conda-token @ file:///Users/paulyim/miniconda3/envs/c3i/conda-bld/conda-token_1662660369760/work
58
+ conda-verify==3.4.2
59
+ constantly==15.1.0
60
+ cookiecutter @ file:///opt/conda/conda-bld/cookiecutter_1649151442564/work
61
+ cryptography @ file:///tmp/build/80754af9/cryptography_1652101588893/work
62
+ cssselect==1.1.0
63
+ cycler @ file:///tmp/build/80754af9/cycler_1637851556182/work
64
+ Cython @ file:///opt/conda/conda-bld/cython_1663692770955/work
65
+ cytoolz==0.11.0
66
+ daal4py==2021.6.0
67
+ dask @ file:///tmp/abs_994957d9-ec12-411f-b953-c010f9d489d10hj3gz4k/croots/recipe/dask-core_1658513209934/work
68
+ datashader @ file:///tmp/abs_aa58dfo4_s/croots/recipe/datashader_1659349033064/work
69
+ datashape==0.5.4
70
+ debugpy @ file:///tmp/build/80754af9/debugpy_1637091799509/work
71
+ decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work
72
+ defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work
73
+ diff-match-patch @ file:///Users/ktietz/demo/mc3/conda-bld/diff-match-patch_1630511840874/work
74
+ dill==0.3.7
75
+ distributed @ file:///tmp/abs_593da390-bd12-4acc-ba49-4c9993cbe8abgqg_w3rb/croots/recipe/distributed_1658520746481/work
76
+ docutils @ file:///opt/conda/conda-bld/docutils_1657175430858/work
77
+ entrypoints @ file:///tmp/build/80754af9/entrypoints_1649926439650/work
78
+ et-xmlfile==1.1.0
79
+ exceptiongroup==1.1.3
80
+ -e git+ssh://[email protected]/X1AOX1A/Demos.git@bddbd1d412227d9a27b0e3dc7c7fa9e5e17a614a#egg=fairseq&subdirectory=fairseq
81
+ fastapi==0.103.1
82
+ fastjsonschema @ file:///opt/conda/conda-bld/python-fastjsonschema_1661371079312/work
83
+ ffmpy==0.3.1
84
+ filelock @ file:///opt/conda/conda-bld/filelock_1647002191454/work
85
+ flake8 @ file:///opt/conda/conda-bld/flake8_1648129545443/work
86
+ Flask @ file:///home/ktietz/src/ci/flask_1611932660458/work
87
+ flatbuffers==23.5.9
88
+ fonttools==4.25.0
89
+ fsspec @ file:///opt/conda/conda-bld/fsspec_1659972197723/work
90
+ future @ file:///tmp/build/80754af9/future_1607571303524/work
91
+ gast==0.4.0
92
+ gensim @ file:///tmp/build/80754af9/gensim_1646806807927/work
93
+ gitdb==4.0.10
94
+ GitPython==3.1.32
95
+ glob2 @ file:///home/linux1/recipes/ci/glob2_1610991677669/work
96
+ gmpy2 @ file:///tmp/build/80754af9/gmpy2_1645438755360/work
97
+ google-auth==2.18.0
98
+ google-auth-oauthlib==1.0.0
99
+ google-pasta==0.2.0
100
+ gradio==3.43.2
101
+ gradio_client==0.5.0
102
+ greenlet @ file:///tmp/build/80754af9/greenlet_1628888132713/work
103
+ grpcio==1.54.0
104
+ h11==0.14.0
105
+ h5py @ file:///tmp/abs_4aewd3wzey/croots/recipe/h5py_1659091371897/work
106
+ HeapDict @ file:///Users/ktietz/demo/mc3/conda-bld/heapdict_1630598515714/work
107
+ holoviews @ file:///tmp/abs_eecc808c-455e-4be4-9911-ecf8341b3a34jfwskiqe/croots/recipe/holoviews_1658171506757/work
108
+ httpcore==0.17.3
109
+ httpx==0.24.1
110
+ huggingface-hub==0.16.4
111
+ hvplot @ file:///tmp/abs_6fcys5jcv1/croots/recipe/hvplot_1659026496554/work
112
+ hydra-core==1.0.7
113
+ hyperlink @ file:///tmp/build/80754af9/hyperlink_1610130746837/work
114
+ idna @ file:///tmp/build/80754af9/idna_1637925883363/work
115
+ imagecodecs @ file:///opt/conda/conda-bld/imagecodecs_1664561985385/work
116
+ imageio @ file:///tmp/abs_cd920173-f360-47c5-97b0-bf4d1076d5d4dvic0oys/croots/recipe/imageio_1658785036907/work
117
+ imagesize @ file:///opt/conda/conda-bld/imagesize_1657179498843/work
118
+ importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648544546694/work
119
+ importlib-resources==6.0.1
120
+ incremental @ file:///tmp/build/80754af9/incremental_1636629750599/work
121
+ inflection==0.5.1
122
+ iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
123
+ intake @ file:///opt/conda/conda-bld/intake_1647436631684/work
124
+ intervaltree @ file:///Users/ktietz/demo/mc3/conda-bld/intervaltree_1630511889664/work
125
+ ipykernel @ file:///opt/conda/conda-bld/ipykernel_1662361798230/work
126
+ ipython @ file:///tmp/abs_94gruux8u8/croots/recipe/ipython_1659529858706/work
127
+ ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work
128
+ ipywidgets @ file:///tmp/build/80754af9/ipywidgets_1634143127070/work
129
+ isort @ file:///tmp/build/80754af9/isort_1628603791788/work
130
+ itemadapter @ file:///tmp/build/80754af9/itemadapter_1626442940632/work
131
+ itemloaders @ file:///opt/conda/conda-bld/itemloaders_1646805235997/work
132
+ itsdangerous @ file:///tmp/build/80754af9/itsdangerous_1621432558163/work
133
+ jax==0.4.9
134
+ jdcal @ file:///Users/ktietz/demo/mc3/conda-bld/jdcal_1630584345063/work
135
+ jedi @ file:///tmp/build/80754af9/jedi_1644297102865/work
136
+ jeepney @ file:///tmp/build/80754af9/jeepney_1627537048313/work
137
+ jellyfish @ file:///tmp/build/80754af9/jellyfish_1647944426575/work
138
+ Jinja2 @ file:///tmp/build/80754af9/jinja2_1612213139570/work
139
+ jinja2-time @ file:///opt/conda/conda-bld/jinja2-time_1649251842261/work
140
+ jmespath @ file:///Users/ktietz/demo/mc3/conda-bld/jmespath_1630583964805/work
141
+ joblib @ file:///tmp/build/80754af9/joblib_1635411271373/work
142
+ json5 @ file:///tmp/build/80754af9/json5_1624432770122/work
143
+ jsonschema @ file:///opt/conda/conda-bld/jsonschema_1663375472438/work
144
+ jupyter @ file:///tmp/abs_33h4eoipez/croots/recipe/jupyter_1659349046347/work
145
+ jupyter-console @ file:///opt/conda/conda-bld/jupyter_console_1647002188872/work
146
+ jupyter-contrib-core==0.4.2
147
+ jupyter-contrib-nbextensions==0.7.0
148
+ jupyter-highlight-selected-word==0.2.0
149
+ jupyter-nbextensions-configurator==0.6.1
150
+ jupyter-server @ file:///tmp/abs_b88b31b8-83b9-476d-a46d-e563c421f38fvsnyi1ur/croots/recipe/jupyter_server_1658754481507/work
151
+ jupyter_client @ file:///opt/conda/conda-bld/jupyter_client_1661848916004/work
152
+ jupyter_core @ file:///opt/conda/conda-bld/jupyter_core_1664917302524/work
153
+ jupyterlab @ file:///tmp/abs_12f3h01vmy/croots/recipe/jupyterlab_1658907535764/work
154
+ jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work
155
+ jupyterlab-server @ file:///opt/conda/conda-bld/jupyterlab_server_1644500396812/work
156
+ jupyterlab-widgets @ file:///tmp/build/80754af9/jupyterlab_widgets_1609884341231/work
157
+ keras==2.12.0
158
+ keyring @ file:///tmp/build/80754af9/keyring_1638531355686/work
159
+ kiwisolver @ file:///opt/conda/conda-bld/kiwisolver_1653292039266/work
160
+ lazy-object-proxy @ file:///tmp/build/80754af9/lazy-object-proxy_1616529027849/work
161
+ libarchive-c @ file:///tmp/build/80754af9/python-libarchive-c_1617780486945/work
162
+ libclang==16.0.0
163
+ lit==16.0.3
164
+ llvmlite==0.38.0
165
+ locket @ file:///opt/conda/conda-bld/locket_1652903118915/work
166
+ loguru==0.7.0
167
+ lxml @ file:///opt/conda/conda-bld/lxml_1657545139709/work
168
+ lz4 @ file:///tmp/build/80754af9/lz4_1619516502891/work
169
+ Markdown @ file:///tmp/build/80754af9/markdown_1614363852612/work
170
+ markdown-it-py==3.0.0
171
+ MarkupSafe @ file:///tmp/build/80754af9/markupsafe_1621523467000/work
172
+ matplotlib @ file:///opt/conda/conda-bld/matplotlib-suite_1660167928326/work
173
+ matplotlib-inline @ file:///opt/conda/conda-bld/matplotlib-inline_1662014470464/work
174
+ mccabe @ file:///opt/conda/conda-bld/mccabe_1644221741721/work
175
+ mdurl==0.1.2
176
+ -e git+ssh://[email protected]/X1AOX1A/Constrained_Image_Caption.git@36bce6f4b517b8f5ea26ec00a171523ffd0fa874#egg=minigpt4
177
+ mistune @ file:///tmp/build/80754af9/mistune_1607364877025/work
178
+ mkl-fft==1.3.1
179
+ mkl-random @ file:///tmp/build/80754af9/mkl_random_1626186066731/work
180
+ mkl-service==2.4.0
181
+ ml-dtypes==0.1.0
182
+ mock @ file:///tmp/build/80754af9/mock_1607622725907/work
183
+ mpmath==1.2.1
184
+ msgpack @ file:///opt/conda/conda-bld/msgpack-python_1652362659880/work
185
+ multipledispatch @ file:///tmp/build/80754af9/multipledispatch_1607574243360/work
186
+ multiprocess==0.70.15
187
+ munkres==1.1.4
188
+ mypy-extensions==0.4.3
189
+ navigator-updater==0.3.0
190
+ nbclassic @ file:///opt/conda/conda-bld/nbclassic_1644943264176/work
191
+ nbclient @ file:///tmp/build/80754af9/nbclient_1650290509967/work
192
+ nbconvert @ file:///opt/conda/conda-bld/nbconvert_1649751911790/work
193
+ nbformat @ file:///opt/conda/conda-bld/nbformat_1663744952973/work
194
+ nest-asyncio @ file:///tmp/build/80754af9/nest-asyncio_1649847906199/work
195
+ networkx @ file:///opt/conda/conda-bld/networkx_1657784097507/work
196
+ nltk @ file:///opt/conda/conda-bld/nltk_1645628263994/work
197
+ nose @ file:///opt/conda/conda-bld/nose_1642704612149/work
198
+ notebook @ file:///tmp/abs_abf6xa6h6f/croots/recipe/notebook_1659083654985/work
199
+ numba @ file:///opt/conda/conda-bld/numba_1648040517072/work
200
+ numexpr @ file:///opt/conda/conda-bld/numexpr_1656940300424/work
201
+ numpy==1.23.5
202
+ numpydoc @ file:///opt/conda/conda-bld/numpydoc_1657529872251/work
203
+ nvidia-cublas-cu11==11.10.3.66
204
+ nvidia-cuda-cupti-cu11==11.7.101
205
+ nvidia-cuda-nvrtc-cu11==11.7.99
206
+ nvidia-cuda-runtime-cu11==11.7.99
207
+ nvidia-cudnn-cu11==8.5.0.96
208
+ nvidia-cufft-cu11==10.9.0.58
209
+ nvidia-curand-cu11==10.2.10.91
210
+ nvidia-cusolver-cu11==11.4.0.1
211
+ nvidia-cusparse-cu11==11.7.4.91
212
+ nvidia-nccl-cu11==2.14.3
213
+ nvidia-nvtx-cu11==11.7.91
214
+ oauthlib==3.2.2
215
+ olefile @ file:///Users/ktietz/demo/mc3/conda-bld/olefile_1629805411829/work
216
+ omegaconf==2.0.6
217
+ opencv-python==4.8.0.76
218
+ openpyxl==3.0.10
219
+ opt-einsum==3.3.0
220
+ orjson==3.9.7
221
+ packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
222
+ pandas==1.4.4
223
+ pandocfilters @ file:///opt/conda/conda-bld/pandocfilters_1643405455980/work
224
+ panel @ file:///tmp/abs_bb3d3b2f-b3ea-41c0-a72e-8f54852d5cdfs70inytz/croots/recipe/panel_1658133826470/work
225
+ param @ file:///tmp/build/80754af9/param_1636647414893/work
226
+ parsel @ file:///tmp/build/80754af9/parsel_1646722533460/work
227
+ parso @ file:///opt/conda/conda-bld/parso_1641458642106/work
228
+ partd @ file:///opt/conda/conda-bld/partd_1647245470509/work
229
+ pathlib @ file:///Users/ktietz/demo/mc3/conda-bld/pathlib_1629713961906/work
230
+ pathos==0.3.1
231
+ pathspec @ file:///tmp/abs_1foqurpsov/croots/recipe/pathspec_1659627126545/work
232
+ patsy==0.5.2
233
+ pep8==1.7.1
234
+ pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work
235
+ pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work
236
+ Pillow==9.2.0
237
+ pkginfo @ file:///tmp/build/80754af9/pkginfo_1643162084911/work
238
+ platformdirs @ file:///opt/conda/conda-bld/platformdirs_1662711380096/work
239
+ plotly @ file:///tmp/abs_7afcdfad-dbbb-49d2-adea-186abf525c45jbnd8p95/croots/recipe/plotly_1658160053621/work
240
+ pluggy @ file:///tmp/build/80754af9/pluggy_1648024445381/work
241
+ ply==3.11
242
+ portalocker==2.7.0
243
+ pox==0.3.3
244
+ poyo @ file:///tmp/build/80754af9/poyo_1617751526755/work
245
+ ppft==1.7.6.7
246
+ prometheus-client @ file:///tmp/abs_d3zeliano1/croots/recipe/prometheus_client_1659455100375/work
247
+ prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1633440160888/work
248
+ Protego @ file:///tmp/build/80754af9/protego_1598657180827/work
249
+ protobuf==4.23.0
250
+ psutil @ file:///opt/conda/conda-bld/psutil_1656431268089/work
251
+ ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
252
+ py @ file:///opt/conda/conda-bld/py_1644396412707/work
253
+ pyarrow==12.0.1
254
+ pyasn1 @ file:///Users/ktietz/demo/mc3/conda-bld/pyasn1_1629708007385/work
255
+ pyasn1-modules==0.2.8
256
+ pycocotools==2.0.6
257
+ pycodestyle @ file:///tmp/build/80754af9/pycodestyle_1636635402688/work
258
+ pycosat==0.6.3
259
+ pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
260
+ pyct @ file:///tmp/abs_68a517ee-55fb-480e-82ab-1a8adb440a58x7qfc024/croots/recipe/pyct_1658500310800/work
261
+ pycurl==7.45.1
262
+ pydantic==2.3.0
263
+ pydantic_core==2.6.3
264
+ pydeck==0.8.0
265
+ PyDispatcher==2.0.5
266
+ pydocstyle @ file:///tmp/build/80754af9/pydocstyle_1621600989141/work
267
+ pydub==0.25.1
268
+ pyerfa @ file:///tmp/build/80754af9/pyerfa_1621556109336/work
269
+ pyflakes @ file:///tmp/build/80754af9/pyflakes_1636644436481/work
270
+ Pygments==2.16.1
271
+ PyHamcrest @ file:///tmp/build/80754af9/pyhamcrest_1615748656804/work
272
+ PyJWT @ file:///opt/conda/conda-bld/pyjwt_1657544592787/work
273
+ pylint @ file:///tmp/abs_6fxmc66kyk/croots/recipe/pylint_1659110350161/work
274
+ pyls-spyder==0.4.0
275
+ Pympler==1.0.1
276
+ pyodbc @ file:///tmp/abs_d365zrcsdp/croots/recipe/pyodbc_1659513794382/work
277
+ pyOpenSSL @ file:///opt/conda/conda-bld/pyopenssl_1643788558760/work
278
+ pyparsing @ file:///opt/conda/conda-bld/pyparsing_1661452539315/work
279
+ PyQt5-sip==12.11.0
280
+ pyrsistent @ file:///tmp/build/80754af9/pyrsistent_1636110951836/work
281
+ PySocks @ file:///tmp/build/80754af9/pysocks_1605305812635/work
282
+ pytest==7.1.2
283
+ python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work
284
+ python-lsp-black @ file:///opt/conda/conda-bld/python-lsp-black_1661852031497/work
285
+ python-lsp-jsonrpc==1.0.0
286
+ python-lsp-server @ file:///opt/conda/conda-bld/python-lsp-server_1661813814476/work
287
+ python-multipart==0.0.6
288
+ python-slugify @ file:///tmp/build/80754af9/python-slugify_1620405669636/work
289
+ python-snappy @ file:///tmp/build/80754af9/python-snappy_1610133040135/work
290
+ pytz @ file:///opt/conda/conda-bld/pytz_1654762638606/work
291
+ pytz-deprecation-shim==0.1.0.post0
292
+ pyviz-comms @ file:///tmp/build/80754af9/pyviz_comms_1623747165329/work
293
+ PyWavelets @ file:///tmp/build/80754af9/pywavelets_1648710015787/work
294
+ pyxdg @ file:///tmp/build/80754af9/pyxdg_1603822279816/work
295
+ PyYAML==6.0
296
+ pyzmq @ file:///opt/conda/conda-bld/pyzmq_1657724186960/work
297
+ QDarkStyle @ file:///tmp/build/80754af9/qdarkstyle_1617386714626/work
298
+ qstylizer @ file:///tmp/build/80754af9/qstylizer_1617713584600/work/dist/qstylizer-0.1.10-py2.py3-none-any.whl
299
+ QtAwesome @ file:///tmp/build/80754af9/qtawesome_1637160816833/work
300
+ qtconsole @ file:///opt/conda/conda-bld/qtconsole_1662018252641/work
301
+ QtPy @ file:///opt/conda/conda-bld/qtpy_1662014892439/work
302
+ queuelib==1.5.0
303
+ regex @ file:///tmp/abs_41f5bce5-0a2e-45aa-b231-1fd2fbd57753gfpe6sjm/croots/recipe/regex_1658257178822/work
304
+ requests @ file:///opt/conda/conda-bld/requests_1657734628632/work
305
+ requests-file @ file:///Users/ktietz/demo/mc3/conda-bld/requests-file_1629455781986/work
306
+ requests-oauthlib==1.3.1
307
+ rich==13.5.2
308
+ rope @ file:///opt/conda/conda-bld/rope_1643788605236/work
309
+ rsa==4.9
310
+ Rtree @ file:///tmp/build/80754af9/rtree_1618420843093/work
311
+ ruamel-yaml-conda @ file:///tmp/build/80754af9/ruamel_yaml_1616016711199/work
312
+ ruamel.yaml @ file:///croot/ruamel.yaml_1666304550667/work
313
+ ruamel.yaml.clib @ file:///croot/ruamel.yaml.clib_1666302247304/work
314
+ s3transfer @ file:///opt/conda/conda-bld/s3transfer_1654524197066/work
315
+ sacrebleu==2.3.1
316
+ sacremoses==0.0.53
317
+ scikit-image @ file:///tmp/build/80754af9/scikit-image_1648214171611/work
318
+ scikit-learn @ file:///tmp/build/80754af9/scikit-learn_1642617106979/work
319
+ scikit-learn-intelex==2021.20221004.171807
320
+ scipy==1.9.1
321
+ Scrapy @ file:///tmp/abs_e3bmwi01y8/croots/recipe/scrapy_1659598696235/work
322
+ seaborn @ file:///tmp/build/80754af9/seaborn_1629307859561/work
323
+ SecretStorage @ file:///tmp/build/80754af9/secretstorage_1614022780358/work
324
+ semantic-version==2.10.0
325
+ Send2Trash @ file:///tmp/build/80754af9/send2trash_1632406701022/work
326
+ service-identity @ file:///Users/ktietz/demo/mc3/conda-bld/service_identity_1629460757137/work
327
+ sip @ file:///tmp/abs_44cd77b_pu/croots/recipe/sip_1659012365470/work
328
+ six @ file:///tmp/build/80754af9/six_1644875935023/work
329
+ smart-open @ file:///opt/conda/conda-bld/smart_open_1651563547610/work
330
+ smmap==5.0.0
331
+ sniffio @ file:///tmp/build/80754af9/sniffio_1614030464178/work
332
+ snowballstemmer @ file:///tmp/build/80754af9/snowballstemmer_1637937080595/work
333
+ sortedcollections @ file:///tmp/build/80754af9/sortedcollections_1611172717284/work
334
+ sortedcontainers @ file:///tmp/build/80754af9/sortedcontainers_1623949099177/work
335
+ soupsieve @ file:///tmp/build/80754af9/soupsieve_1636706018808/work
336
+ speaksee==0.0.1
337
+ Sphinx @ file:///opt/conda/conda-bld/sphinx_1657784123546/work
338
+ sphinxcontrib-applehelp @ file:///home/ktietz/src/ci/sphinxcontrib-applehelp_1611920841464/work
339
+ sphinxcontrib-devhelp @ file:///home/ktietz/src/ci/sphinxcontrib-devhelp_1611920923094/work
340
+ sphinxcontrib-htmlhelp @ file:///tmp/build/80754af9/sphinxcontrib-htmlhelp_1623945626792/work
341
+ sphinxcontrib-jsmath @ file:///home/ktietz/src/ci/sphinxcontrib-jsmath_1611920942228/work
342
+ sphinxcontrib-qthelp @ file:///home/ktietz/src/ci/sphinxcontrib-qthelp_1611921055322/work
343
+ sphinxcontrib-serializinghtml @ file:///tmp/build/80754af9/sphinxcontrib-serializinghtml_1624451540180/work
344
+ spyder @ file:///opt/conda/conda-bld/spyder_1663056818299/work
345
+ spyder-kernels @ file:///opt/conda/conda-bld/spyder-kernels_1662457880976/work
346
+ SQLAlchemy @ file:///tmp/abs_18b3238f-9c23-4182-a392-63af30a93c1er8j_yw60/croots/recipe/sqlalchemy_1657867856580/work
347
+ starlette==0.27.0
348
+ statsmodels @ file:///tmp/build/80754af9/statsmodels_1648015433305/work
349
+ streamlit==1.25.0
350
+ streamlit-drawable-canvas==0.9.3
351
+ sympy @ file:///tmp/build/80754af9/sympy_1647853653589/work
352
+ tables @ file:///tmp/build/80754af9/pytables_1607975397488/work
353
+ tabulate @ file:///opt/conda/conda-bld/tabulate_1657784105888/work
354
+ TBB==0.2
355
+ tblib @ file:///Users/ktietz/demo/mc3/conda-bld/tblib_1629402031467/work
356
+ tenacity==8.2.2
357
+ tensorboard==2.12.3
358
+ tensorboard-data-server==0.7.0
359
+ tensorboardX==2.6.2
360
+ tensorflow==2.12.0
361
+ tensorflow-estimator==2.12.0
362
+ tensorflow-io-gcs-filesystem==0.32.0
363
+ termcolor==2.3.0
364
+ terminado @ file:///tmp/build/80754af9/terminado_1644322582718/work
365
+ testpath @ file:///opt/conda/conda-bld/testpath_1655908557405/work
366
+ text-unidecode @ file:///Users/ktietz/demo/mc3/conda-bld/text-unidecode_1629401354553/work
367
+ textdistance @ file:///tmp/build/80754af9/textdistance_1612461398012/work
368
+ threadpoolctl @ file:///Users/ktietz/demo/mc3/conda-bld/threadpoolctl_1629802263681/work
369
+ three-merge @ file:///tmp/build/80754af9/three-merge_1607553261110/work
370
+ tifffile @ file:///tmp/build/80754af9/tifffile_1627275862826/work
371
+ tinycss @ file:///tmp/build/80754af9/tinycss_1617713798712/work
372
+ tldextract @ file:///opt/conda/conda-bld/tldextract_1646638314385/work
373
+ toml @ file:///tmp/build/80754af9/toml_1616166611790/work
374
+ tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
375
+ tomlkit @ file:///tmp/abs_56_0lnnq5x/croots/recipe/tomlkit_1658946880479/work
376
+ toolz @ file:///tmp/build/80754af9/toolz_1636545406491/work
377
+ torch==2.0.1
378
+ torchaudio==2.0.1
379
+ torchvision==0.15.2
380
+ tornado @ file:///tmp/build/80754af9/tornado_1606942317143/work
381
+ tqdm @ file:///opt/conda/conda-bld/tqdm_1664392687731/work
382
+ traitlets @ file:///tmp/build/80754af9/traitlets_1636710298902/work
383
+ triton==2.0.0
384
+ Twisted @ file:///tmp/abs_82802zpkox/croots/recipe/twisted_1659592759417/work
385
+ typing_extensions==4.7.1
386
+ tzdata==2023.3
387
+ tzlocal==4.3.1
388
+ ujson @ file:///opt/conda/conda-bld/ujson_1657544923770/work
389
+ Unidecode @ file:///tmp/build/80754af9/unidecode_1614712377438/work
390
+ urllib3 @ file:///tmp/abs_5dhwnz6atv/croots/recipe/urllib3_1659110457909/work
391
+ uvicorn==0.23.2
392
+ validators==0.20.0
393
+ w3lib @ file:///Users/ktietz/demo/mc3/conda-bld/w3lib_1629359764703/work
394
+ watchdog @ file:///tmp/build/80754af9/watchdog_1638367282716/work
395
+ wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work
396
+ webencodings==0.5.1
397
+ websocket-client @ file:///tmp/build/80754af9/websocket-client_1614803975924/work
398
+ websockets==11.0.3
399
+ Werkzeug @ file:///opt/conda/conda-bld/werkzeug_1645628268370/work
400
+ whatthepatch @ file:///opt/conda/conda-bld/whatthepatch_1661795988879/work
401
+ widgetsnbextension @ file:///tmp/build/80754af9/widgetsnbextension_1644992802045/work
402
+ wrapt @ file:///tmp/abs_c335821b-6e43-4504-9816-b1a52d3d3e1eel6uae8l/croots/recipe/wrapt_1657814400492/work
403
+ wurlitzer @ file:///tmp/build/80754af9/wurlitzer_1638368168359/work
404
+ xarray @ file:///opt/conda/conda-bld/xarray_1639166117697/work
405
+ xlrd @ file:///tmp/build/80754af9/xlrd_1608072521494/work
406
+ XlsxWriter @ file:///opt/conda/conda-bld/xlsxwriter_1649073856329/work
407
+ yapf @ file:///tmp/build/80754af9/yapf_1615749224965/work
408
+ zict==2.1.0
409
+ zipp @ file:///opt/conda/conda-bld/zipp_1652341764480/work
410
+ zope.interface @ file:///tmp/build/80754af9/zope.interface_1625036153595/work
utils.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import jieba
2
+ from functools import partial
3
+ from transformers import BertTokenizer
4
+
5
+ class T5PegasusTokenizer(BertTokenizer):
6
+ def __init__(self, *args, **kwargs):
7
+ super().__init__(*args, **kwargs)
8
+ self.pre_tokenizer = partial(jieba.cut, HMM=False)
9
+
10
+ def _tokenize(self, text, *arg, **kwargs):
11
+ split_tokens = []
12
+ for text in self.pre_tokenizer(text):
13
+ if text in self.vocab:
14
+ split_tokens.append(text)
15
+ else:
16
+ split_tokens.extend(super()._tokenize(text))
17
+ return split_tokens