src/transformers/models/t5/modeling_tf_t5.py/TFT5PreTrainedModel/set_input_embeddings
class TFT5PreTrainedModel:    def set_input_embeddings(self, value):
        try:
            self.shared.weight = value
        except AttributeError:
            self(self.dummy_inputs)
            self.shared.weight = value

        self.shared.vocab_size = shape_list(value)[0]
        # retrieve correct absolute scope for embed token wrapper
        with tf.compat.v1.variable_scope("shared") as shared_abs_scope_name:
            pass
        # Wraps layer to avoid problems with weight restoring and ensuring we're in the correct TF scope.
        embed_tokens = TFWrappedEmbeddings(self.shared, abs_scope_name=shared_abs_scope_name)
        self.encoder.embed_tokens = embed_tokens
        if hasattr(self, "decoder"):
            self.decoder.embed_tokens = embed_tokens