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
33bca541
Unverified
Commit
33bca541
authored
Apr 10, 2024
by
Xu Song
Committed by
GitHub
Apr 10, 2024
Browse files
Fix typing annotation in hf_argparser (#30156)
parent
0f94e3e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/hf_argparser.py
src/transformers/hf_argparser.py
+2
-2
No files found.
src/transformers/hf_argparser.py
View file @
33bca541
...
@@ -376,7 +376,7 @@ class HfArgumentParser(ArgumentParser):
...
@@ -376,7 +376,7 @@ class HfArgumentParser(ArgumentParser):
raise
ValueError
(
f
"Some keys are not used by the HfArgumentParser:
{
sorted
(
unused_keys
)
}
"
)
raise
ValueError
(
f
"Some keys are not used by the HfArgumentParser:
{
sorted
(
unused_keys
)
}
"
)
return
tuple
(
outputs
)
return
tuple
(
outputs
)
def
parse_json_file
(
self
,
json_file
:
str
,
allow_extra_keys
:
bool
=
False
)
->
Tuple
[
DataClass
,
...]:
def
parse_json_file
(
self
,
json_file
:
Union
[
str
,
Path
]
,
allow_extra_keys
:
bool
=
False
)
->
Tuple
[
DataClass
,
...]:
"""
"""
Alternative helper method that does not use `argparse` at all, instead loading a json file and populating the
Alternative helper method that does not use `argparse` at all, instead loading a json file and populating the
dataclass types.
dataclass types.
...
@@ -398,7 +398,7 @@ class HfArgumentParser(ArgumentParser):
...
@@ -398,7 +398,7 @@ class HfArgumentParser(ArgumentParser):
outputs
=
self
.
parse_dict
(
data
,
allow_extra_keys
=
allow_extra_keys
)
outputs
=
self
.
parse_dict
(
data
,
allow_extra_keys
=
allow_extra_keys
)
return
tuple
(
outputs
)
return
tuple
(
outputs
)
def
parse_yaml_file
(
self
,
yaml_file
:
str
,
allow_extra_keys
:
bool
=
False
)
->
Tuple
[
DataClass
,
...]:
def
parse_yaml_file
(
self
,
yaml_file
:
Union
[
str
,
Path
]
,
allow_extra_keys
:
bool
=
False
)
->
Tuple
[
DataClass
,
...]:
"""
"""
Alternative helper method that does not use `argparse` at all, instead loading a yaml file and populating the
Alternative helper method that does not use `argparse` at all, instead loading a yaml file and populating the
dataclass types.
dataclass types.
...
...
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