Commit
·
c1568f1
1
Parent(s):
6c418cb
move to pregenerated tokens
Browse files- generic_ner.py +12 -12
generic_ner.py
CHANGED
|
@@ -678,18 +678,18 @@ def remove_trailing_stopwords(entities):
|
|
| 678 |
|
| 679 |
class MultitaskTokenClassificationPipeline(Pipeline):
|
| 680 |
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
|
| 692 |
-
|
| 693 |
|
| 694 |
def preprocess(self, inputs, **kwargs):
|
| 695 |
|
|
|
|
| 678 |
|
| 679 |
class MultitaskTokenClassificationPipeline(Pipeline):
|
| 680 |
|
| 681 |
+
def _sanitize_parameters(self, **kwargs):
|
| 682 |
+
preprocess_kwargs = {}
|
| 683 |
+
print('kwargs', kwargs)
|
| 684 |
+
if "text" in kwargs:
|
| 685 |
+
preprocess_kwargs["text"] = kwargs["text"]
|
| 686 |
+
print("preprocess_kwargs", preprocess_kwargs)
|
| 687 |
+
self.label_map = self.model.config.label_map
|
| 688 |
+
self.id2label = {
|
| 689 |
+
task: {id_: label for label, id_ in labels.items()}
|
| 690 |
+
for task, labels in self.label_map.items()
|
| 691 |
+
}
|
| 692 |
+
return preprocess_kwargs, {}, {}
|
| 693 |
|
| 694 |
def preprocess(self, inputs, **kwargs):
|
| 695 |
|