How to change transformers model embedding layer weights
I trained my own tokenizer and added new words. Now I need to change the embedding size from the pretrained model. What I do is like this:

```
import transformers as tfm
import tensorflow as tf

backbone = tfm.TFRobertaModel.from_pretrained(PRETRAINED_PATH, output_hidden_states=True)
add_emb = tf.random.uniform(shape=(new_vocab_size, 768), minval=-1., maxval=1.)
new_emb = tf.concat((backbone.roberta.embeddings.word_embeddings, add_emb), 0)
backbone.roberta.weights[194] = new_emb 
```
However, the shape of embedding weight is still the original vocab size.

But if I do 

```
backbone = tfm.TFRobertaModel.from_pretrained(PRETRAINED_PATH, output_hidden_states=True)
add_emb = tf.random.uniform(shape=(new_vocab_size, 768), minval=-1., maxval=1.)
backbone.roberta.embeddings.word_embeddings= tf.concat((backbone.roberta.embeddings.word_embeddings, add_emb), 0)
```
Then the embedding weights will be removed from model ```trainable_weights``` and has only 198 elements instead of 199 in the original list.

Am I doing something wrong to change the embedding weights? Thanks!

The original stack overflow question is also posted:
https://stackoverflow.com/questions/61860156/how-to-change-transformers-model-embedding-layer-weights
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
