Skip to content

I do not understand _normalize_attentions method in API/API_CLIP/hook.py #8

@jaehyeon-postech

Description

@jaehyeon-postech

I'm having some trouble understanding a part of the _normalize_attentions function. Specifically, I'm unsure about the following line of code:

mean_centered = (self.attentions - self.post_ln_mean[:, :, np.newaxis, np.newaxis] / (len_intermediates * normalization_term))

In this context, len_intermediates is set to 47 when _normalize_attentions is called. Could someone explain in detail what this code is doing? In particular, I'm unclear on why we divide by len_intermediates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions