INNER CODE UNIT · Python

_to_box

CogStack/OpenGPT · opengpt/config.py:10

    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
        Args:
            save_path (`str`):
                Where to save the created json file, if nothing we use the default from paths.
        '''

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…