Emanuela Boros commited on
Commit
bffe103
1 Parent(s): 34d59ab

added confidence

Browse files
Files changed (1) hide show
  1. generic_nel.py +2 -3
generic_nel.py CHANGED
@@ -131,11 +131,10 @@ class NelPipeline(Pipeline):
131
  log_prob_sum = sum(transition_scores[0])
132
 
133
  # Calculate the probability for the entire sequence by exponentiating the sum of log probabilities
134
- import numpy as np
135
 
136
- sequence_confidence = np.exp(log_prob_sum)
137
 
138
- percentages = sequence_confidence * 100.0
139
 
140
  # # Process each score (logits for the generated tokens)
141
  # for i, score in enumerate(scores):
 
131
  log_prob_sum = sum(transition_scores[0])
132
 
133
  # Calculate the probability for the entire sequence by exponentiating the sum of log probabilities
 
134
 
135
+ sequence_confidence = torch.exp(log_prob_sum)
136
 
137
+ percentages = sequence_confidence.cpu().numpy() * 100.0
138
 
139
  # # Process each score (logits for the generated tokens)
140
  # for i, score in enumerate(scores):