Cfg

class sorrel.config.Cfg(in_dict: dict)

Configuration class for parsing the YAML configuration file.

Nested config parameters are parsed as nested Cfg objects.

Note

Type hints for these attributes apply to any parameter with the same name, even if they are nested under different entries.

agent: Self
appearance: Any
default_object: Any
env: Self
epochs: int
experiment: Self
height: int
layers: int
log: bool
max_turns: int
model: Any
name: str
num: int
root: str
to_dict()
width: int

Functions

Note that these are functions, not class methods.

sorrel.config.parse_args(command_line: bool = True, args: Sequence[str] | None = None) Namespace

Helper function for preparsing the arguments.

Parameters:
  • command_line (bool) – whether arguments are passed in through the command line. Defaults to True.

  • args (Optional[Sequence[str]]) –

    A sequence of command line-like arguments, if not reading from command line. Defaults to None.

    Note

    By default, the function uses the default –config argument to get the file from ./config.yaml.

    Unknown arguments (i.e., not –config) are ignored.

Returns:

the argparse.Namespace object containing the args.

Return type:

argpase.Namespace

sorrel.config.load_config(args: Namespace) Cfg

Load the parsed arguments into the Cfg class.

Parameters:

args (argparse.Namespace) – the parsed arguments, where args.config must contain the path to the config file.

Returns:

A Cfg class object with the configurations for the experiment.