Skip to content

omegaconf

optimus_dl.core.omegaconf

OmegaConf custom resolvers for configuration.

This module registers custom resolvers for OmegaConf that enable advanced configuration features like Python expression evaluation and environment variable access.

conf_hash_resolver(*args, _root_)

Resolver for computing hash of a root config.

Source code in optimus_dl/core/omegaconf.py
def conf_hash_resolver(*args, _root_):
    """Resolver for computing hash of a root config."""
    max_len = 16
    if len(args) > 0:
        assert len(args) == 1, "Only one argument is allowed"
        max_len = int(args[0])
    return hash_resolver(_root_, max_len=max_len)

hash_resolver(x, max_len=16)

Resolver for computing hash of a value repr.

Source code in optimus_dl/core/omegaconf.py
def hash_resolver(x, max_len=16):
    """Resolver for computing hash of a value repr."""
    x = repr(x)
    return hashlib.sha256(x.encode("utf-8")).hexdigest()[:max_len]