INNER CODE UNIT · Python
print_config
allenai/dolma · python/dolma/cli/__init__.py:165
def print_config(config: Any, console: Optional[Console] = None) -> None:
if not isinstance(config, (DictConfig, ListConfig)):
config = om.create(config)
# print the config as yaml using a rich syntax highlighter
console = console or Console()
yaml_config = om.to_yaml(config, sort_keys=True).strip()
highlighted = Syntax(code=yaml_config, lexer="yaml", theme="ansi_dark")
console.print(highlighted)
class BaseCli(Generic[D]):
CONFIG: Type[D]
DESCRIPTION: Optional[str] = None
@classmethod
def make_parser(cls, parser: A) -> A:
assert hasattr(cls, "CONFIG"), f"{cls.__name__} must have a CONFIG attribute"