Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
70bc3ead
"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "963529e29bdb862d1e5babb630f7b12b6c3081c6"
Commit
70bc3ead
authored
Jun 17, 2020
by
Julien Chaumond
Browse files
[TextClassificationPipeline] Hotfix: make json serializable
parent
7291ea0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/pipelines.py
src/transformers/pipelines.py
+1
-1
No files found.
src/transformers/pipelines.py
View file @
70bc3ead
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment