Skip to content

Latest commit

 

History

History
51 lines (27 loc) · 1.14 KB

common_hooks.rst

File metadata and controls

51 lines (27 loc) · 1.14 KB

Common Hooks

The most common hooking functions are supported out of the box by Unseal.

Some of the methods can be used directly as a function in a hook, others return such a function and some will return the hook itself. This will be indicated in the docstring.

Saving Outputs

This method can be used directly in the construction of a hook.

unseal.hooks.common_hooks.save_output

Replacing Activations

This method is a factory and returns a function that can be used in a hook to replace the activation of a layer.

unseal.hooks.common_hooks.replace_activation

Saving Attention

unseal.hooks.common_hooks.transformers_get_attention

Creating an Attention Hook

unseal.hooks.common_hooks.create_attention_hook

Creating a Logit Hook

unseal.hooks.common_hooks.create_logit_hook

GPT _attn Wrapper

unseal.hooks.common_hooks.gpt_attn_wrapper