TuneRecipeArgumentParser¶
- class torchtune.utils.TuneRecipeArgumentParser(*args, **kwargs)[source]¶
A helpful utility subclass of the
argparse.ArgumentParser
that adds a builtin argument “config”. The config argument takes a file path to a YAML file and loads in argument defaults from said file. The YAML file must only contain argument names and their values and nothing more, it does not have to include all of the arguments. These values will be treated as defaults and can still be overridden from the command line. Everything else works the same as the base ArgumentParser and you should consult the docs for more info: https://docs.python.org/3/library/argparse.html.Note
This class uses “config” as a builtin argument so it is not available to use.
- parse_known_args(*args, **kwargs) Tuple[Namespace, List[str]] [source]¶
This acts the same as the base parse_known_args but will first load in defaults from from the config yaml file if it is provided. The command line args will always take precident over the values in the config file. All other parsing method, such as parse_args, internally call this method so they will inherit this property too. For more info see the docs for the base method: https://docs.python.org/3/library/argparse.html#the-parse-args-method.