Example #1
0
    def vote_entities(self, model_inputs, sent, id2ent, threshold):
        entities_ls = []
        for idx, model in enumerate(self.models):
            tmp_tokens = model(**model_inputs)[0][0]
            tmp_entities = crf_decode(tmp_tokens, sent, id2ent)
            entities_ls.append(tmp_entities)

        return vote(entities_ls, threshold)
Example #2
0
    def vote_entities(self, model_inputs, sent, id2ent, threshold):
        entities_ls = []

        for idx, model in enumerate(self.models):

            start_logits, end_logits = model(**model_inputs)
            start_logits = start_logits[0].cpu().numpy()[1:1 + len(sent)]
            end_logits = end_logits[0].cpu().numpy()[1:1 + len(sent)]

            decode_entities = span_decode(start_logits, end_logits, sent, id2ent)

            entities_ls.append(decode_entities)

        return vote(entities_ls, threshold)