Commit
•
831be6d
1
Parent(s):
dbb3d10
Update deploy_pipeline.py
Browse files- deploy_pipeline.py +6 -5
deploy_pipeline.py
CHANGED
@@ -41,7 +41,6 @@ class TokenizeAndAlignLabelsStep():
|
|
41 |
return tokenized_inputs
|
42 |
|
43 |
|
44 |
-
|
45 |
class BERT_CRF_Pipeline(Pipeline):
|
46 |
|
47 |
def _sanitize_parameters(self, **kwargs):
|
@@ -75,14 +74,16 @@ class BERT_CRF_Pipeline(Pipeline):
|
|
75 |
outputs = self.model(input_ids=input_ids, token_type_ids=token_type_ids,
|
76 |
attention_mask=attention_mask, labels=None, labels_mask=labels_mask)
|
77 |
|
78 |
-
return outputs
|
79 |
|
80 |
-
def postprocess(self, model_outputs):
|
81 |
# From Ner_tags to Ner_labels
|
82 |
for i, label in enumerate(model_outputs[0]):
|
83 |
model_outputs[0][i] = self.model.config.id2label[label]
|
84 |
-
|
85 |
-
|
|
|
|
|
86 |
|
87 |
|
88 |
def main():
|
|
|
41 |
return tokenized_inputs
|
42 |
|
43 |
|
|
|
44 |
class BERT_CRF_Pipeline(Pipeline):
|
45 |
|
46 |
def _sanitize_parameters(self, **kwargs):
|
|
|
74 |
outputs = self.model(input_ids=input_ids, token_type_ids=token_type_ids,
|
75 |
attention_mask=attention_mask, labels=None, labels_mask=labels_mask)
|
76 |
|
77 |
+
return outputs, tokenizer_results['tokens']
|
78 |
|
79 |
+
def postprocess(self, model_outputs, tokenizer_results):
|
80 |
# From Ner_tags to Ner_labels
|
81 |
for i, label in enumerate(model_outputs[0]):
|
82 |
model_outputs[0][i] = self.model.config.id2label[label]
|
83 |
+
|
84 |
+
print(tokenizer_results)
|
85 |
+
|
86 |
+
return model_outputs[0], tokenizer_results
|
87 |
|
88 |
|
89 |
def main():
|