| 141 | cls._auto_class = auto_class |
| 142 | |
| 143 | def register_to_config(self, **kwargs): |
| 144 | if self.config_name is None: |
| 145 | raise NotImplementedError(f"Make sure that {self.__class__} has defined a class name `config_name`") |
| 146 | # Special case for `kwargs` used in deprecation warning added to schedulers |
| 147 | # TODO: remove this when we remove the deprecation warning, and the `kwargs` argument, |
| 148 | # or solve in a more general way. |
| 149 | kwargs.pop("kwargs", None) |
| 150 | |
| 151 | if not hasattr(self, "_internal_dict"): |
| 152 | internal_dict = kwargs |
| 153 | else: |
| 154 | previous_dict = dict(self._internal_dict) |
| 155 | internal_dict = {**self._internal_dict, **kwargs} |
| 156 | logger.debug(f"Updating config from {previous_dict} to {internal_dict}") |
| 157 | |
| 158 | self._internal_dict = FrozenDict(internal_dict) |
| 159 | |
| 160 | def __getattr__(self, name: str) -> Any: |
| 161 | """The only reason we overwrite `getattr` here is to gracefully deprecate accessing |