blapuma commited on
Commit
905823e
·
verified ·
1 Parent(s): fcc5a19

Upload MyTestPipeline

Browse files
Files changed (1) hide show
  1. new_task.py +4 -1
new_task.py CHANGED
@@ -5,7 +5,7 @@ import numpy as np
5
 
6
  class MyTestPipeline(TextGenerationPipeline):
7
  def preprocess(self, text, **kwargs):
8
- prompt = 'Answer the following question/statement without any explanation, do not abbreviate names, and give just the answer.'
9
  txt = f"<|user|>\n{prompt} {text}\n<|end|>\n<|assistant|>"
10
  return self.tokenizer(txt, return_tensors=self.framework)
11
 
@@ -35,5 +35,8 @@ class MyTestPipeline(TextGenerationPipeline):
35
  log_probs = np.round(np.exp(transition_scores.cpu().numpy()), 3)[0]
36
  guess_prob = np.product(log_probs)
37
 
 
 
 
38
  return {'guess': guess_text, 'confidence': guess_prob}
39
 
 
5
 
6
  class MyTestPipeline(TextGenerationPipeline):
7
  def preprocess(self, text, **kwargs):
8
+ prompt = 'Answer the following question/statement without any explanation, do not abbreviate names.'
9
  txt = f"<|user|>\n{prompt} {text}\n<|end|>\n<|assistant|>"
10
  return self.tokenizer(txt, return_tensors=self.framework)
11
 
 
35
  log_probs = np.round(np.exp(transition_scores.cpu().numpy()), 3)[0]
36
  guess_prob = np.product(log_probs)
37
 
38
+ if guess_prob >= 0.8:
39
+ guess_prob = 1.0
40
+
41
  return {'guess': guess_text, 'confidence': guess_prob}
42