INNER CODE UNIT · Python

BaseConfig

CogStack/OpenGPT · opengpt/config.py:6

class BaseConfig(object):
    def __init__(self, to_box=False):
        pass

    def _to_box(self):
        # Convert all dicts to boxes
        for key, val in self.__dict__.items():
            if isinstance(val, dict):
                self.__setattr__(key, Box(val))

    def _from_box(self):
        # Convert all dicts to boxes
        for key, val in self.__dict__.items():
            if isinstance(val, Box):
                self.__setattr__(key, val.to_dict())

    def save(self, save_path=None):
        r''' Save the config into a .json file

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…