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
7af55d3a
Unverified
Commit
7af55d3a
authored
Oct 21, 2021
by
David del Río Medina
Committed by
GitHub
Oct 21, 2021
Browse files
Replace assertion with ValueError exception (#14098)
parent
f00bceab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
src/transformers/hf_argparser.py
src/transformers/hf_argparser.py
+2
-3
No files found.
src/transformers/hf_argparser.py
View file @
7af55d3a
...
@@ -133,9 +133,8 @@ class HfArgumentParser(ArgumentParser):
...
@@ -133,9 +133,8 @@ class HfArgumentParser(ArgumentParser):
):
):
kwargs
[
"nargs"
]
=
"+"
kwargs
[
"nargs"
]
=
"+"
kwargs
[
"type"
]
=
field
.
type
.
__args__
[
0
]
kwargs
[
"type"
]
=
field
.
type
.
__args__
[
0
]
assert
all
(
if
not
all
(
x
==
kwargs
[
"type"
]
for
x
in
field
.
type
.
__args__
):
x
==
kwargs
[
"type"
]
for
x
in
field
.
type
.
__args__
raise
ValueError
(
f
"
{
field
.
name
}
cannot be a List of mixed types"
)
),
f
"
{
field
.
name
}
cannot be a List of mixed types"
if
field
.
default_factory
is
not
dataclasses
.
MISSING
:
if
field
.
default_factory
is
not
dataclasses
.
MISSING
:
kwargs
[
"default"
]
=
field
.
default_factory
()
kwargs
[
"default"
]
=
field
.
default_factory
()
elif
field
.
default
is
dataclasses
.
MISSING
:
elif
field
.
default
is
dataclasses
.
MISSING
:
...
...
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