KevlarVK commited on
Commit
c7a5c72
1 Parent(s): 385c7ce

Potential Fix - title bug

Browse files
Files changed (2) hide show
  1. summarizer.py +2 -1
  2. title_generator.py +1 -1
summarizer.py CHANGED
@@ -91,8 +91,9 @@ class BARTSummarizer:
91
  # Summarize each cluster
92
  summaries_with_title = []
93
  for cluster in clustered_sentences:
 
94
  summary = self.chunk_summarize(cluster, auto=True)
95
- summary_with_title = "#### " + self.title_model.summarize(summary) + "\n" + summary
96
  summaries_with_title.append(summary_with_title)
97
 
98
  # Combine the summaries to get the final summary for the entire input
 
91
  # Summarize each cluster
92
  summaries_with_title = []
93
  for cluster in clustered_sentences:
94
+ title = self.title_model.summarize(cluster)
95
  summary = self.chunk_summarize(cluster, auto=True)
96
+ summary_with_title = "#### " + title + "\n" + summary
97
  summaries_with_title.append(summary_with_title)
98
 
99
  # Combine the summaries to get the final summary for the entire input
title_generator.py CHANGED
@@ -9,6 +9,6 @@ class T5Summarizer:
9
  inputs = ["summarize: " + text]
10
  max_input_length = self.tokenizer.model_max_length
11
  inputs = self.tokenizer(inputs, max_length=max_input_length, truncation=True, return_tensors="tf")
12
- output = self.model.generate(**inputs, num_beams=8, do_sample=True, min_length=1, max_length=10, early_stopping=True)
13
  summary = self.tokenizer.batch_decode(output, skip_special_tokens=True)[0]
14
  return summary
 
9
  inputs = ["summarize: " + text]
10
  max_input_length = self.tokenizer.model_max_length
11
  inputs = self.tokenizer(inputs, max_length=max_input_length, truncation=True, return_tensors="tf")
12
+ output = self.model.generate(**inputs, num_beams=12, do_sample=True, min_length=2, max_length=8)
13
  summary = self.tokenizer.batch_decode(output, skip_special_tokens=True)[0]
14
  return summary