Blaise-g commited on
Commit
b92ee4f
β€’
1 Parent(s): 092679d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -44,14 +44,24 @@ def proc_submission(
44
  str in HTML format, string of the summary, str of compression rate in %
45
  """
46
 
47
- settings = {
48
- "length_penalty": float(length_penalty),
49
  "repetition_penalty": 3.5,
50
  "no_repeat_ngram_size": 3,
51
  "encoder_no_repeat_ngram_size": 4,
52
  "num_beams": int(num_beams),
53
  "min_length": 11,
54
- "max_length": int(token_batch_length // 4),
 
 
 
 
 
 
 
 
 
 
55
  "early_stopping": True,
56
  }
57
  st = time.perf_counter()
@@ -75,7 +85,7 @@ def proc_submission(
75
  model_led_tldr if (model_type == "LED") else model_tldr,
76
  tokenizer_led_tldr if (model_type == "LED") else tokenizer_tldr,
77
  batch_length=token_batch_length,
78
- **settings,
79
  )
80
 
81
  else:
@@ -84,7 +94,7 @@ def proc_submission(
84
  model_led_det if (model_type == "LED") else model_det,
85
  tokenizer_led_det if (model_type == "LED") else tokenizer_det,
86
  batch_length=token_batch_length,
87
- **settings,
88
  )
89
  #_summaries = summarize_via_tokenbatches(
90
  #tr_in,
 
44
  str in HTML format, string of the summary, str of compression rate in %
45
  """
46
 
47
+ settings_tldr = {
48
+ "length_penalty": 0.6,
49
  "repetition_penalty": 3.5,
50
  "no_repeat_ngram_size": 3,
51
  "encoder_no_repeat_ngram_size": 4,
52
  "num_beams": int(num_beams),
53
  "min_length": 11,
54
+ "max_length": 62,
55
+ "early_stopping": True,
56
+ }
57
+ settings_det = {
58
+ "length_penalty": float(length_penalty),#2.0 if (model_type == "LED") else 0.8,
59
+ "repetition_penalty": 3.5,
60
+ "no_repeat_ngram_size": 3,
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()
 
85
  model_led_tldr if (model_type == "LED") else model_tldr,
86
  tokenizer_led_tldr if (model_type == "LED") else tokenizer_tldr,
87
  batch_length=token_batch_length,
88
+ **settings_tldr,
89
  )
90
 
91
  else:
 
94
  model_led_det if (model_type == "LED") else model_det,
95
  tokenizer_led_det if (model_type == "LED") else tokenizer_det,
96
  batch_length=token_batch_length,
97
+ **settings_det,
98
  )
99
  #_summaries = summarize_via_tokenbatches(
100
  #tr_in,