ML Wong commited on
Commit
411fb81
1 Parent(s): 597c86a

Update model

Browse files
models/npc-bert-gpt2-best/model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ffa5b9e133f91b3757ce917312ddc5c57754cb4f5e94b6942bcf1cdc612f623f
3
  size 1046838512
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ddbf903b6f48ae6b9e950249c403ea0bb51060cff36457968fc932b0e22130c4
3
  size 1046838512
npc_bert_models/summary_module.py CHANGED
@@ -1,6 +1,7 @@
1
  from transformers import AutoTokenizer, EncoderDecoderModel
2
  from transformers import pipeline as hf_pipeline
3
  from pathlib import Path
 
4
 
5
 
6
  class NpcBertGPT2():
@@ -33,10 +34,10 @@ class NpcBertGPT2():
33
  device='cpu',
34
  num_beams=4,
35
  do_sample=True,
36
- top_p = 0.92,
37
- top_k = 0,
38
  early_stopping=True,
39
- no_repeat_ngram_size=2,
40
  max_new_tokens=60)
41
 
42
  def __call__(self, *args):
@@ -61,5 +62,13 @@ class NpcBertGPT2():
61
  pipe_out, = self.pipeline(*args)
62
 
63
  pipe_out = pipe_out['generated_text']
 
 
 
 
 
 
 
64
  return pipe_out
 
65
 
 
1
  from transformers import AutoTokenizer, EncoderDecoderModel
2
  from transformers import pipeline as hf_pipeline
3
  from pathlib import Path
4
+ import re
5
 
6
 
7
  class NpcBertGPT2():
 
34
  device='cpu',
35
  num_beams=4,
36
  do_sample=True,
37
+ top_k = 5,
38
+ temperature=.95,
39
  early_stopping=True,
40
+ no_repeat_ngram_size=5,
41
  max_new_tokens=60)
42
 
43
  def __call__(self, *args):
 
62
  pipe_out, = self.pipeline(*args)
63
 
64
  pipe_out = pipe_out['generated_text']
65
+
66
+ # remove repeated lines by hard coding
67
+ mo = re.search("\. (questionable|anterio|zius)", pipe_out)
68
+
69
+ if mo is not None:
70
+ end_sig = mo.start()
71
+ pipe_out = pipe_out[:end_sig + 1]
72
  return pipe_out
73
+
74