mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
[TextClassificationPipeline] Hotfix: make json serializable
This commit is contained in:
parent
7291ea0bff
commit
70bc3ead4f
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user