gt4sd.cli.argument_parser module¶
Argument parser for training pipelines.
Summary¶
Classes:
ArgumentParser inherited from hf's parser with modified dataclass arguments addition for better handling of None values. |
Functions:
Parse a lambda from a string safely. |
|
Check given argument for None. |
|
Check given bool argument for None. |
Reference¶
- eval_lambda(val)[source]¶
Parse a lambda from a string safely.
- Parameters
val (
str
) – string representing a lambda.- Return type
Callable
- Returns
a callable.
- Raises
ValueError – in case the lambda can not be parsed.
- none_checker_bool(val)[source]¶
Check given bool argument for None.
- Parameters
val (
Union
[bool
,str
]) – model arguments passed to the configuration.- Return type
Optional
[bool
,None
]- Returns
Bool value or None.
- Raises
ArgumentTypeError – value can not be parsed.
- none_checker(val, dtype)[source]¶
Check given argument for None.
- Parameters
val (
Any
) – model arguments passed to the configuration.dtype (
Type
) – expected argument type.
- Return type
Any
- Returns
Value casted in the expected type or None.
- class ArgumentParser(dataclass_types, **kwargs)[source]¶
Bases:
HfArgumentParser
ArgumentParser inherited from hf’s parser with modified dataclass arguments addition for better handling of None values.
- _add_dataclass_arguments(dtype)[source]¶
Add a dataclass arguments.
- Parameters
dtype (
DataClassType
) – data class type.- Return type
None
- __annotations__ = {}¶
- __doc__ = "ArgumentParser inherited from hf's parser with modified dataclass arguments addition for better handling of None values."¶
- __module__ = 'gt4sd.cli.argument_parser'¶