init
Browse files
experiments/model_predict_ner.py
CHANGED
@@ -96,7 +96,6 @@ class NER:
|
|
96 |
})
|
97 |
prob = torch.softmax(output['logits'], dim=-1).cpu().detach().float().tolist()
|
98 |
print(prob)
|
99 |
-
print(prob.shape)
|
100 |
pred = torch.max(prob, dim=-1)[1].cpu().detach().int().tolist()
|
101 |
preds += [[self.id_to_label[_p] for _p in p] for p in pred]
|
102 |
return [{"prediction": p, "label": i} for p, i in zip(preds, labels)]
|
|
|
96 |
})
|
97 |
prob = torch.softmax(output['logits'], dim=-1).cpu().detach().float().tolist()
|
98 |
print(prob)
|
|
|
99 |
pred = torch.max(prob, dim=-1)[1].cpu().detach().int().tolist()
|
100 |
preds += [[self.id_to_label[_p] for _p in p] for p in pred]
|
101 |
return [{"prediction": p, "label": i} for p, i in zip(preds, labels)]
|