Blaise-g commited on
Commit
d9bfa14
Β·
1 Parent(s): 768c8f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -24,7 +24,6 @@ def proc_submission(
24
  num_beams,
25
  token_batch_length,
26
  length_penalty,
27
- #no_repeat_ngram_size: int = 3,
28
  max_input_length: int = 768,
29
  ):
30
  """
@@ -61,7 +60,7 @@ def proc_submission(
61
  "encoder_no_repeat_ngram_size": 4,
62
  "num_beams": int(num_beams),
63
  "min_length": 100,
64
- "max_length": int(token_batch_length // 4) if (token_batch_length <500) else 512,
65
  "early_stopping": True,
66
  }
67
  st = time.perf_counter()
@@ -72,7 +71,7 @@ def proc_submission(
72
 
73
  if processed["was_truncated"]:
74
  tr_in = processed["truncated_text"]
75
- msg = f"Input text was truncated to {max_input_length} words (based on whitespace)"
76
  logging.warning(msg)
77
  history["WARNING"] = msg
78
  else:
@@ -96,10 +95,8 @@ def proc_submission(
96
  #batch_length=token_batch_length,
97
  #**settings_det,
98
  #)
99
- if summary_type == 'TLDR':
100
- settings = settings_tldr
101
- else:# summary_type == 'Detailed':
102
- settings = settings_det
103
 
104
  _summaries = summarize_via_tokenbatches(
105
  tr_in,
 
24
  num_beams,
25
  token_batch_length,
26
  length_penalty,
 
27
  max_input_length: int = 768,
28
  ):
29
  """
 
60
  "encoder_no_repeat_ngram_size": 4,
61
  "num_beams": int(num_beams),
62
  "min_length": 100,
63
+ "max_length": 512#int(token_batch_length // 4) if (token_batch_length <500) else 512,
64
  "early_stopping": True,
65
  }
66
  st = time.perf_counter()
 
71
 
72
  if processed["was_truncated"]:
73
  tr_in = processed["truncated_text"]
74
+ msg = f"Input text was truncated to {max_input_length} words to fit within computational constraints"
75
  logging.warning(msg)
76
  history["WARNING"] = msg
77
  else:
 
95
  #batch_length=token_batch_length,
96
  #**settings_det,
97
  #)
98
+
99
+ settings = settings_tldr if summary_type == 'TLDR' else settings_det
 
 
100
 
101
  _summaries = summarize_via_tokenbatches(
102
  tr_in,