Update app.py
Browse files
app.py
CHANGED
@@ -41,17 +41,34 @@ def proc_submission(
|
|
41 |
str in HTML format, string of the summary, str of score
|
42 |
"""
|
43 |
|
44 |
-
|
45 |
"length_penalty": float(length_penalty),
|
46 |
"repetition_penalty": 3.5,
|
47 |
"no_repeat_ngram_size": 3,
|
48 |
"encoder_no_repeat_ngram_size": 4,
|
49 |
"num_beams": int(num_beams),
|
50 |
-
"min_length":
|
51 |
-
"max_length": int(token_batch_length // 4),
|
52 |
"early_stopping": True,
|
53 |
"do_sample": False,
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
st = time.perf_counter()
|
56 |
history = {}
|
57 |
clean_text = clean(input_text, lower=False)
|
@@ -169,7 +186,7 @@ if __name__ == "__main__":
|
|
169 |
value=2,
|
170 |
)
|
171 |
gr.Markdown(
|
172 |
-
"_The
|
173 |
)
|
174 |
with gr.Row():
|
175 |
length_penalty = gr.inputs.Slider(
|
|
|
41 |
str in HTML format, string of the summary, str of score
|
42 |
"""
|
43 |
|
44 |
+
settings_det = {
|
45 |
"length_penalty": float(length_penalty),
|
46 |
"repetition_penalty": 3.5,
|
47 |
"no_repeat_ngram_size": 3,
|
48 |
"encoder_no_repeat_ngram_size": 4,
|
49 |
"num_beams": int(num_beams),
|
50 |
+
"min_length": 100,
|
51 |
+
"max_length": 512,#int(token_batch_length // 4),
|
52 |
"early_stopping": True,
|
53 |
"do_sample": False,
|
54 |
}
|
55 |
+
settings_tldr = {
|
56 |
+
"length_penalty": float(length_penalty),
|
57 |
+
"repetition_penalty": 3.5,
|
58 |
+
"no_repeat_ngram_size": 3,
|
59 |
+
"encoder_no_repeat_ngram_size": 4,
|
60 |
+
"num_beams": int(num_beams),
|
61 |
+
"min_length": 11,
|
62 |
+
"max_length": 62,
|
63 |
+
"early_stopping": True,
|
64 |
+
"do_sample": False,
|
65 |
+
}
|
66 |
+
|
67 |
+
if model_size == "tldr":
|
68 |
+
settings = settings_tldr
|
69 |
+
else:
|
70 |
+
settings = settings_det
|
71 |
+
|
72 |
st = time.perf_counter()
|
73 |
history = {}
|
74 |
clean_text = clean(input_text, lower=False)
|
|
|
186 |
value=2,
|
187 |
)
|
188 |
gr.Markdown(
|
189 |
+
"_The tldr model variant takes less time to produce the summaries and accepts a longer input sequence all other parameters being equal._"
|
190 |
)
|
191 |
with gr.Row():
|
192 |
length_penalty = gr.inputs.Slider(
|