optimum/graphcore/models/bart/modeling_bart.py
def change_bart_encoder_and_decoder_classes(self, restore: bool):
        """Changes the encoder and decoder classes to update their forward pass so that they use our custom versions of
        _make_causal_mask and _expand_mask.

        Args:
            restore: whether to restore the encoder and decoder to their original version or not.
        """
        self.encoder.__class__ = BartEncoder if restore else _BartEncoderWithCustomExpandMask
        self.decoder.__class__ = BartDecoder if restore else _BartDecoderWithCustomMakeCausalAndExpandMask
Changes the encoder and decoder classes to update their forward pass so that they use our custom versions of
        _make_causal_mask and _expand_mask.

        Args:
            restore: whether to restore the encoder and decoder to their original version or not.
        
Changes the encoder and decoder classes to update their forward pass so that they use our custom versions of
_make_causal_mask and _expand_mask.
Changes the encoder and decoder classes to update their forward pass so that they use our custom versions of _make_causal_mask and _expand_mask .
def change_bart_encoder_and_decoder_classes(self, restore: bool):
        self.encoder.__class__ = BartEncoder if restore else _BartEncoderWithCustomExpandMask
        self.decoder.__class__ = BartDecoder if restore else _BartDecoderWithCustomMakeCausalAndExpandMask
def change_bart_encoder_and_decoder_classes ( self , restore : bool ) : self . encoder . __class__ = BartEncoder if restore else _BartEncoderWithCustomExpandMask self . decoder . __class__ = BartDecoder if restore else _BartDecoderWithCustomMakeCausalAndExpandMask
Changes the encoder and decoder classes to update their forward pass so that they use our custom versions of
_make_causal_mask and _expand_mask.
Changes the encoder and decoder classes to update their forward pass so that they use our custom versions of _make_causal_mask and _expand_mask .
"""Changes the encoder and decoder classes to update their forward pass so that they use our custom versions of
        _make_causal_mask and _expand_mask.

        Args:
            restore: whether to restore the encoder and decoder to their original version or not.
        """
self
restore
bool
whether to restore the encoder and decoder to their original version or not.
whether to restore the encoder and decoder to their original version or not .