lm_polygraph.estimators.attention_score module

class lm_polygraph.estimators.attention_score.AttentionScore(layer: int = None, gen_only: bool = False)[source]

Bases: Estimator

Estimates uncertainty based on model’s attention weights as in Attention Score method from https://openreview.net/forum?id=LYx4w3CAgy

lm_polygraph.estimators.attention_score.unpad_attentions(forwardpass_attention_weights_original)[source]

Unpad batched and padded with np.nan attentions.