"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "963529e29bdb862d1e5babb630f7b12b6c3081c6"
Commit 70bc3ead authored by Julien Chaumond's avatar Julien Chaumond
Browse files

[TextClassificationPipeline] Hotfix: make json serializable

parent 7291ea0b
......@@ -728,7 +728,7 @@ class TextClassificationPipeline(Pipeline):
scores = np.exp(outputs) / np.exp(outputs).sum(-1, keepdims=True)
if self.return_all_scores:
return [
[{"label": self.model.config.id2label[i], "score": score} for i, score in enumerate(item)]
[{"label": self.model.config.id2label[i], "score": score.item()} for i, score in enumerate(item)]
for item in scores
]
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment