transformer_lens.model_bridge.supported_architectures.bart module¶
BART adapter and the shared BART-family encoder-decoder base (BART, Marian, MBart, Pegasus, Blenderbot, M2M100/NLLB); per-member differences are declarative.
- class transformer_lens.model_bridge.supported_architectures.bart.BartArchitectureAdapter(cfg: Any)¶
Bases:
BartFamilyArchitectureAdapterArchitecture adapter for BartForConditionalGeneration models.
Post-LN with layernorm_embedding; checkpoints ship scale_embedding=False, so the family default-on is disabled.
- component_mapping: ComponentMapping | None¶
- force_scale_embedding: bool = False¶
- has_layernorm_embedding: bool = True¶
- uses_split_attention: bool¶
- weight_processing_conversions: Dict[str, ParamProcessingConversion | str] | None¶
- class transformer_lens.model_bridge.supported_architectures.bart.BartFamilyArchitectureAdapter(cfg: Any)¶
Bases:
ArchitectureAdapterShared base for the BART-family encoder-decoder adapters.
- __init__(cfg: Any) None¶
Validate the config, set family flags, and build the mapping.
- force_scale_embedding: bool = True¶
- has_final_stack_norm: bool = False¶
- has_layernorm_embedding: bool = False¶
- n_layers_from: str = 'encoder'¶
- require_symmetric_layers: bool = True¶
- setup_hook_compatibility(bridge: Any) None¶
Fold the trained final_logits_bias into the unembed bias.
HF adds the buffer after lm_head, so b_U would read fabricated zeros and unembed.hook_out would fire pre-bias (Marian opus-mt trains it). Moving it into the bias UnembeddingBridge injects is numerically identity; zeroing the buffer keeps the (re-run) fold idempotent.