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
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "30c172fc203add539d5e08393c0c6c7a2fbc6a71"
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
Hide 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):
):
kwargs
[
"nargs"
]
=
"+"
kwargs
[
"type"
]
=
field
.
type
.
__args__
[
0
]
assert
all
(
x
==
kwargs
[
"type"
]
for
x
in
field
.
type
.
__args__
),
f
"
{
field
.
name
}
cannot be a List of mixed types"
if
not
all
(
x
==
kwargs
[
"type"
]
for
x
in
field
.
type
.
__args__
):
raise
ValueError
(
f
"
{
field
.
name
}
cannot be a List of mixed types"
)
if
field
.
default_factory
is
not
dataclasses
.
MISSING
:
kwargs
[
"default"
]
=
field
.
default_factory
()
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