optimum/graphcore/models/bart/modeling_bart.py
def change_bart_attention_class(self, restore: bool):
        """Changes the attention layers to either use the original BartAttention forward or
        BartAttentionWithoutException forward.

        Args:
            restore: whether to restore the attention layers to their original version or not.
        """
        new_cls = BartAttention if restore else _BartAttentionWithoutException
        for mod in self.modules():
            if isinstance(mod, BartAttention):
                mod.__class__ = new_cls
Changes the attention layers to either use the original BartAttention forward or
        BartAttentionWithoutException forward.

        Args:
            restore: whether to restore the attention layers to their original version or not.
        
Changes the attention layers to either use the original BartAttention forward or
BartAttentionWithoutException forward.
Changes the attention layers to either use the original BartAttention forward or BartAttentionWithoutException forward .
def change_bart_attention_class(self, restore: bool):
        new_cls = BartAttention if restore else _BartAttentionWithoutException
        for mod in self.modules():
            if isinstance(mod, BartAttention):
                mod.__class__ = new_cls
def change_bart_attention_class ( self , restore : bool ) : new_cls = BartAttention if restore else _BartAttentionWithoutException for mod in self . modules ( ) : if isinstance ( mod , BartAttention ) : mod . __class__ = new_cls
Changes the attention layers to either use the original BartAttention forward or
BartAttentionWithoutException forward.
Changes the attention layers to either use the original BartAttention forward or BartAttentionWithoutException forward .
"""Changes the attention layers to either use the original BartAttention forward or
        BartAttentionWithoutException forward.

        Args:
            restore: whether to restore the attention layers to their original version or not.
        """
self
restore
bool
whether to restore the attention layers to their original version or not.
whether to restore the attention layers to their original version or not .