mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-04 13:20:12 +06:00
Fix typing annotation in hf_argparser (#30156)
This commit is contained in:
parent
0f94e3e152
commit
33bca5419c
@ -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):
|
|||||||
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user