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
fa1a8d10
"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "566698a00669628626b15347c16338856a6ef17e"
Commit
fa1a8d10
authored
Mar 11, 2021
by
Sylvain Gugger
Browse files
Tentative fix for HFArgumentParser in Python 3.8
parent
2f848519
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/transformers/hf_argparser.py
src/transformers/hf_argparser.py
+4
-1
No files found.
src/transformers/hf_argparser.py
View file @
fa1a8d10
...
...
@@ -14,6 +14,7 @@
import
dataclasses
import
json
import
re
import
sys
from
argparse
import
ArgumentParser
,
ArgumentTypeError
from
enum
import
Enum
...
...
@@ -113,7 +114,9 @@ class HfArgumentParser(ArgumentParser):
kwargs
[
"nargs"
]
=
"?"
# This is the value that will get picked if we do --field_name (without value)
kwargs
[
"const"
]
=
True
elif
hasattr
(
field
.
type
,
"__origin__"
)
and
issubclass
(
field
.
type
.
__origin__
,
List
):
elif
(
hasattr
(
field
.
type
,
"__origin__"
)
and
re
.
search
(
r
"^typing\.List\[(.*)\]$"
,
str
(
field
.
type
))
is
not
None
):
kwargs
[
"nargs"
]
=
"+"
kwargs
[
"type"
]
=
field
.
type
.
__args__
[
0
]
assert
all
(
...
...
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