Emanuela Boros
commited on
Commit
•
67633ff
1
Parent(s):
3df5bff
added confidence
Browse files- generic_nel.py +1 -3
generic_nel.py
CHANGED
@@ -120,9 +120,6 @@ class NelPipeline(Pipeline):
|
|
120 |
wikipedia_predictions = self.tokenizer.batch_decode(
|
121 |
outputs.sequences, skip_special_tokens=True
|
122 |
)
|
123 |
-
# Initialize confidence list for each token
|
124 |
-
token_confidences = []
|
125 |
-
|
126 |
# Process the scores for each token
|
127 |
all_probabilities = []
|
128 |
import torch.nn.functional as F
|
@@ -139,6 +136,7 @@ class NelPipeline(Pipeline):
|
|
139 |
|
140 |
# Store the probabilities
|
141 |
all_probabilities.append(top_probabilities)
|
|
|
142 |
|
143 |
# Convert probabilities into percentages if needed
|
144 |
percentages = [(prob * 100.0).tolist() for prob in all_probabilities]
|
|
|
120 |
wikipedia_predictions = self.tokenizer.batch_decode(
|
121 |
outputs.sequences, skip_special_tokens=True
|
122 |
)
|
|
|
|
|
|
|
123 |
# Process the scores for each token
|
124 |
all_probabilities = []
|
125 |
import torch.nn.functional as F
|
|
|
136 |
|
137 |
# Store the probabilities
|
138 |
all_probabilities.append(top_probabilities)
|
139 |
+
print(f"Top probabilities: {top_probabilities}")
|
140 |
|
141 |
# Convert probabilities into percentages if needed
|
142 |
percentages = [(prob * 100.0).tolist() for prob in all_probabilities]
|