def parse_file_or_obj(cls, file_or_obj: Union[str, Path, dict]) -> "ConfigBase":
        """Parse a file or a dictionary object into a ConfigBase object.

        :param file_or_obj: File path or dictionary object.
            File can be a YAML file with .yaml or .yml extension or a JSON file with .json extension.
        :return: ConfigBase object.
        """
        if isinstance(file_or_obj, dict):
            obj = file_or_obj
        else:
            obj = load_config_file(file_or_obj)

        return cls.parse_obj(obj)
Parse a file or a dictionary object into a ConfigBase object.

        :param file_or_obj: File path or dictionary object.
            File can be a YAML file with .yaml or .yml extension or a JSON file with .json extension.
        :return: ConfigBase object.
        
olive/common/config_utils.py