optimum/graphcore/models/bert/modeling_bert.py
def deparallelize(self):
        """
        Undo the changes to the model done by `parallelize`.
        You should call this before doing `save_pretrained` so that the `model.state_dict` is
        compatible with the original model.
        """
        super().deparallelize()

        for layer in self.bert.encoder.layer:
            layer.attention.self.__class__ = BertSelfAttention

        if self.ipu_config.embedding_serialization_factor > 1:
            decoder = nn.Linear(
                self.config.hidden_size,
                self.config.vocab_size,
                bias=True,
            )
            decoder.load_state_dict(self.cls.predictions.decoder.state_dict())
            self.cls.predictions.decoder = decoder
            self.tie_weights()
        return self

        Undo the changes to the model done by `parallelize`.
        You should call this before doing `save_pretrained` so that the `model.state_dict` is
        compatible with the original model.
        
Undo the changes to the model done by `parallelize`.
You should call this before doing `save_pretrained` so that the `model.state_dict` is
compatible with the original model.
Undo the changes to the model done by ` parallelize ` . You should call this before doing ` save_pretrained ` so that the ` model . state_dict ` is compatible with the original model .
def deparallelize(self):
        super().deparallelize()
        for layer in self.bert.encoder.layer:
            layer.attention.self.__class__ = BertSelfAttention
        if self.ipu_config.embedding_serialization_factor > 1:
            decoder = nn.Linear(
                self.config.hidden_size,
                self.config.vocab_size,
                bias=True,
            )
            decoder.load_state_dict(self.cls.predictions.decoder.state_dict())
            self.cls.predictions.decoder = decoder
            self.tie_weights()
        return self
def deparallelize ( self ) : super ( ) . deparallelize ( ) for layer in self . bert . encoder . layer : layer . attention . self . __class__ = BertSelfAttention if self . ipu_config . embedding_serialization_factor > 1 : decoder = nn . Linear ( self . config . hidden_size , self . config . vocab_size , bias = True , ) decoder . load_state_dict ( self . cls . predictions . decoder . state_dict ( ) ) self . cls . predictions . decoder = decoder self . tie_weights ( ) return self
Undo the changes to the model done by `parallelize`.
Undo the changes to the model done by ` parallelize ` .
"""
        Undo the changes to the model done by `parallelize`.
        You should call this before doing `save_pretrained` so that the `model.state_dict` is
        compatible with the original model.
        """
self