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
bbc707cf
Commit
bbc707cf
authored
Dec 16, 2019
by
Morgan Funtowicz
Browse files
Fix non-keyworded varargs handling in DefaultArgumentHandler for pipeline.
parent
9c391277
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
transformers/pipelines.py
transformers/pipelines.py
+7
-2
No files found.
transformers/pipelines.py
View file @
bbc707cf
...
...
@@ -55,7 +55,12 @@ class DefaultArgumentHandler(ArgumentHandler):
return
kwargs
[
'X'
]
elif
'data'
in
kwargs
:
return
kwargs
[
'data'
]
elif
len
(
args
)
>
0
:
elif
len
(
args
)
==
1
:
if
isinstance
(
args
[
0
],
list
):
return
args
[
0
]
else
:
return
[
args
[
0
]]
elif
len
(
args
)
>
1
:
return
list
(
args
)
raise
ValueError
(
'Unable to infer the format of the provided data (X=, data=, ...)'
)
...
...
@@ -240,7 +245,7 @@ class NerPipeline(Pipeline):
def
__call__
(
self
,
*
texts
,
**
kwargs
):
inputs
,
answers
=
self
.
_args_parser
(
*
texts
,
**
kwargs
),
[]
for
sentence
in
tex
ts
:
for
sentence
in
inpu
ts
:
# Ugly token to word idx mapping (for now)
token_to_word
,
words
=
[],
sentence
.
split
(
' '
)
...
...
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