MCPcopy
hub / github.com/huggingface/diffusers / register_to_config

Method register_to_config

src/diffusers/configuration_utils.py:143–158  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

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

Callers 15

save_pretrainedMethod · 0.80
from_configMethod · 0.80
from_pipeMethod · 0.80
from_pipeMethod · 0.80
from_pipeMethod · 0.80
register_modulesMethod · 0.80
register_modulesMethod · 0.80
__setattr__Method · 0.80
save_pretrainedMethod · 0.80
from_pretrainedMethod · 0.80
from_pipeMethod · 0.80
__init__Method · 0.80

Calls 2

FrozenDictClass · 0.85
popMethod · 0.45

Tested by 7

test_inferenceMethod · 0.64
test_callback_inputsMethod · 0.64