transformers
3b64c740 - Build the migrated attention modules from their config

Commit
91 days ago
Build the migrated attention modules from their config The attention classes touched by this PR took embed_dim, num_heads, dropout and bias as constructor arguments, all of them plumbed through from values the config already holds. Read them from the config instead and keep only the flags that genuinely differ between call sites: is_causal, layer_idx, and the is_decoder/is_cross_attention selectors for models whose encoder and decoder read different config fields. is_decoder was write-only in the LED, MVP, XGLM and TrOCR attentions, so it is dropped there. ProphetNet's shape assert becomes a ValueError, since asserts are stripped under -O.
Author
Parents
Loading