Coverage for transformer_lens/model_bridge/supported_architectures/pegasus.py: 100%

3 statements  

« prev     ^ index     » next       coverage.py v7.10.1, created at 2026-08-11 18:50 +0000

1"""Pegasus architecture adapter. 

2 

3Google's PEGASUS summarization family (``PegasusForConditionalGeneration``): 

4pre-norm encoder-decoder with per-stack final LayerNorms (M2M100-style 

5layout), Marian-style deterministic sinusoidal position embeddings, and the 

6sqrt(d_model) embedding scale applied in the stack forward — so, as with 

7Marian and unlike M2M100/MBart, hooks on ``embed`` observe unscaled output. 

8""" 

9 

10from transformer_lens.model_bridge.supported_architectures.bart import ( 

11 BartFamilyArchitectureAdapter, 

12) 

13 

14 

15class PegasusArchitectureAdapter(BartFamilyArchitectureAdapter): 

16 """Architecture adapter for PegasusForConditionalGeneration models.""" 

17 

18 has_final_stack_norm = True