Peter commited on
Commit
afa6ede
1 Parent(s): 8dbbc84

:art: apply formatting

Browse files
Files changed (2) hide show
  1. app.py +9 -5
  2. summarize.py +3 -1
app.py CHANGED
@@ -128,9 +128,7 @@ if __name__ == "__main__":
128
 
129
  model, tokenizer = load_model_and_tokenizer("pszemraj/led-large-book-summary")
130
  title = "Long-Form Summarization: LED & BookSum"
131
- description = (
132
- "A simple demo of how to use a fine-tuned LED model to summarize long-form text. [This model](https://huggingface.co/pszemraj/led-large-book-summary) is a fine-tuned version of [allenai/led-large-16384](https://huggingface.co/allenai/led-large-16384) on the [BookSum dataset](https://arxiv.org/abs/2105.08209). The goal was to create a model that can generalize well and is useful in summarizing lots of text in academic and daily usage."
133
- )
134
 
135
  gr.Interface(
136
  proc_submission,
@@ -140,7 +138,11 @@ if __name__ == "__main__":
140
  minimum=1, maximum=6, label="num_beams", default=4, step=1
141
  ),
142
  gr.inputs.Slider(
143
- minimum=512, maximum=2048, label="token_batch_length", default=1024, step=512,
 
 
 
 
144
  ),
145
  gr.inputs.Slider(
146
  minimum=0.5, maximum=1.1, label="length_penalty", default=0.7, step=0.05
@@ -163,4 +165,6 @@ if __name__ == "__main__":
163
  article="The model can be used with tag [pszemraj/led-large-book-summary](https://huggingface.co/pszemraj/led-large-book-summary). See the model card for details on usage & a notebook for a tutorial.",
164
  examples=load_examples(),
165
  cache_examples=False,
166
- ).launch(enable_queue=True, )
 
 
 
128
 
129
  model, tokenizer = load_model_and_tokenizer("pszemraj/led-large-book-summary")
130
  title = "Long-Form Summarization: LED & BookSum"
131
+ description = "A simple demo of how to use a fine-tuned LED model to summarize long-form text. [This model](https://huggingface.co/pszemraj/led-large-book-summary) is a fine-tuned version of [allenai/led-large-16384](https://huggingface.co/allenai/led-large-16384) on the [BookSum dataset](https://arxiv.org/abs/2105.08209). The goal was to create a model that can generalize well and is useful in summarizing lots of text in academic and daily usage."
 
 
132
 
133
  gr.Interface(
134
  proc_submission,
 
138
  minimum=1, maximum=6, label="num_beams", default=4, step=1
139
  ),
140
  gr.inputs.Slider(
141
+ minimum=512,
142
+ maximum=2048,
143
+ label="token_batch_length",
144
+ default=1024,
145
+ step=512,
146
  ),
147
  gr.inputs.Slider(
148
  minimum=0.5, maximum=1.1, label="length_penalty", default=0.7, step=0.05
 
165
  article="The model can be used with tag [pszemraj/led-large-book-summary](https://huggingface.co/pszemraj/led-large-book-summary). See the model card for details on usage & a notebook for a tutorial.",
166
  examples=load_examples(),
167
  cache_examples=False,
168
+ ).launch(
169
+ enable_queue=True,
170
+ )
summarize.py CHANGED
@@ -93,7 +93,9 @@ def summarize_via_tokenbatches(
93
  if batch_length < 512:
94
  batch_length = 512
95
  print("WARNING: batch_length was set to 512")
96
- print(f"input parameters: {kwargs}, batch_length={batch_length}, batch_stride={batch_stride}")
 
 
97
  encoded_input = tokenizer(
98
  input_text,
99
  padding="max_length",
 
93
  if batch_length < 512:
94
  batch_length = 512
95
  print("WARNING: batch_length was set to 512")
96
+ print(
97
+ f"input parameters: {kwargs}, batch_length={batch_length}, batch_stride={batch_stride}"
98
+ )
99
  encoded_input = tokenizer(
100
  input_text,
101
  padding="max_length",