Tie the weights between the input embeddings and the output embeddings. If the `torchscript` flag is set in the configuration, can't handle parameter sharing so we are cloning the weights instead.
(self)
| 346 | return None # Overwrite for models with output embeddings |
| 347 | |
| 348 | def tie_weights(self): |
| 349 | """ |
| 350 | Tie the weights between the input embeddings and the output embeddings. |
| 351 | If the `torchscript` flag is set in the configuration, can't handle parameter sharing so we are cloning |
| 352 | the weights instead. |
| 353 | """ |
| 354 | output_embeddings = self.get_output_embeddings() |
| 355 | if output_embeddings is not None: |
| 356 | self._tie_or_clone_weights(output_embeddings, self.get_input_embeddings()) |
| 357 | |
| 358 | def _tie_or_clone_weights(self, output_embeddings, input_embeddings): |
| 359 | """ Tie or clone module weights depending of whether we are using TorchScript or not |
no test coverage detected