optimum/graphcore/models/bart/modeling_bart.py
def encoder_and_decoder_embeddings_computation(self, use_shared_embedding: bool):
        """Sets the BartModel shared embedding layer to SharedEmbedding that combines the computation under one layer.

        Args:
            use_shared_embedding: whether to use SharedEmbedding or not.
        """

        if use_shared_embedding:
            if isinstance(self.shared, SharedEmbedding):
                logger.warning("encoder and decoder embeddings computation is already shared")
            else:
                self.shared = SharedEmbedding(self.shared)
        else:
            if isinstance(self.shared, nn.Embedding):
                logger.warning("encoder and decoder embeddings computation is not shared")
            else:
                self.shared = self.shared.shared
Sets the BartModel shared embedding layer to SharedEmbedding that combines the computation under one layer.

        Args:
            use_shared_embedding: whether to use SharedEmbedding or not.
        
Sets the BartModel shared embedding layer to SharedEmbedding that combines the computation under one layer.
Sets the BartModel shared embedding layer to SharedEmbedding that combines the computation under one layer .
def encoder_and_decoder_embeddings_computation(self, use_shared_embedding: bool):
        if use_shared_embedding:
            if isinstance(self.shared, SharedEmbedding):
                logger.warning("encoder and decoder embeddings computation is already shared")
            else:
                self.shared = SharedEmbedding(self.shared)
        else:
            if isinstance(self.shared, nn.Embedding):
                logger.warning("encoder and decoder embeddings computation is not shared")
            else:
                self.shared = self.shared.shared
def encoder_and_decoder_embeddings_computation ( self , use_shared_embedding : bool ) : if use_shared_embedding : if isinstance ( self . shared , SharedEmbedding ) : logger . warning ( "encoder and decoder embeddings computation is already shared" ) else : self . shared = SharedEmbedding ( self . shared ) else : if isinstance ( self . shared , nn . Embedding ) : logger . warning ( "encoder and decoder embeddings computation is not shared" ) else : self . shared = self . shared . shared
Sets the BartModel shared embedding layer to SharedEmbedding that combines the computation under one layer.
Sets the BartModel shared embedding layer to SharedEmbedding that combines the computation under one layer .
"""Sets the BartModel shared embedding layer to SharedEmbedding that combines the computation under one layer.

        Args:
            use_shared_embedding: whether to use SharedEmbedding or not.
        """
self
use_shared_embedding
bool
whether to use SharedEmbedding or not.
whether to use SharedEmbedding or not .