MCPcopy Create free account
hub / github.com/huggingface/diffusers / _set_context

Method _set_context

src/diffusers/hooks/hooks.py:135–141  ·  view source on GitHub ↗
(self, module: torch.nn.Module, name: str)

Source from the content-addressed store, hash-verified

133 return module
134
135 def _set_context(self, module: torch.nn.Module, name: str) -> None:
136 # Iterate over all attributes of the hook to see if any of them have the type `StateManager`. If so, call `set_context` on them.
137 for attr_name in dir(self):
138 attr = getattr(self, attr_name)
139 if isinstance(attr, StateManager):
140 attr.set_context(name)
141 return module
142
143
144class HookFunctionReference:

Callers 2

cache_contextMethod · 0.45
_set_contextMethod · 0.45

Calls 1

set_contextMethod · 0.80

Tested by

no test coverage detected