ml_collections.config_dict.create

ml_collections.config_dict.create(**kwargs)[source]

Creates a ConfigDict with the given named arguments as key-value pairs.

This allows for simple dictionaries whose elements can be accessed directly using field access:

from ml_collections import config_dict
point = config_dict.create(x=1, y=2)
print(point.x, point.y)

This is particularly useful for compactly writing nested configurations:

config = config_dict.create(
  data=config_dict.create(
    game='freeway',
    frame_size=100),
  model=config_dict.create(num_hidden=1000))

The reason for the existence of this function is that it simplifies the code required for the majority of the use cases of ConfigDict, compared to using either ConfigDict or namedtuple’s. Examples of such use cases include training script configuration, and returning multiple named values.

Parameters:**kwargs – key-value pairs to be stored in the ConfigDict.
Returns:A ConfigDict containing the key-value pairs in kwargs.