MCPcopy Index your code
hub / github.com/huggingface/diffusers / _apply_mag_cache_head_hook

Function _apply_mag_cache_head_hook

src/diffusers/hooks/mag_cache.py:444–452  ·  view source on GitHub ↗
(block: torch.nn.Module, state_manager: StateManager, config: MagCacheConfig)

Source from the content-addressed store, hash-verified

442
443
444def _apply_mag_cache_head_hook(block: torch.nn.Module, state_manager: StateManager, config: MagCacheConfig) -> None:
445 registry = HookRegistry.check_if_exists_or_initialize(block)
446
447 # Automatically remove existing hook to allow re-application (e.g. switching modes)
448 if registry.get_hook(_MAG_CACHE_LEADER_BLOCK_HOOK) is not None:
449 registry.remove_hook(_MAG_CACHE_LEADER_BLOCK_HOOK)
450
451 hook = MagCacheHeadHook(state_manager, config)
452 registry.register_hook(hook, _MAG_CACHE_LEADER_BLOCK_HOOK)
453
454
455def _apply_mag_cache_block_hook(

Callers 1

apply_mag_cacheFunction · 0.85

Calls 5

MagCacheHeadHookClass · 0.85
get_hookMethod · 0.80
remove_hookMethod · 0.80
register_hookMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…