Layer #0 (named "roberta") expects 0 weight(s), but the saved weights have 199 element(s)
# ❓ Questions & Help

## Details
I wanna build a new NLU model extented by TFRobertaPreTrainedModel.
And I write code with reference to 'TFRobertaForSequenceClassification' class.
```python
from transformers import TFRobertaPreTrainedModel, TFRobertaMainLayer
class TFRobertaForNLU(TFRobertaPreTrainedModel):
    def __init__(self, config, *inputs, **kwargs):
        super().__init__(config, *inputs, **kwargs)
        self.roberta = TFRobertaMainLayer(config, name="roberta")

    def call(self,inputs=None,attention_mask=None,token_type_ids=None,position_ids=None,head_mask=None,inputs_embeds=None,output_attentions=None,output_hidden_states=None,labels=None,training=False,):
        pass

model = TFRobertaForNLU.from_pretrained("jplu/tf-xlm-roberta-base")
```
And I got an error:
```python
Traceback (most recent call last):
  File "test.py", line 449, in <module>
  File ".../lib/python3.7/site-packages/transformers/modeling_tf_utils.py", line 489, in from_pretrained
    model.load_weights(resolved_archive_file, by_name=True)
  File ".../lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 181, in load_weights
    return super(Model, self).load_weights(filepath, by_name)
  File ".../lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py", line 1175, in load_weights
    saving.load_weights_from_hdf5_group_by_name(f, self.layers)
  File ".../lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py", line 751, in load_weights_from_hdf5_group_by_name
    str(len(weight_values)) + ' element(s).')
ValueError: Layer #0 (named "roberta") expects 0 weight(s), but the saved weights have 199 element(s).
```

It seems like the 'roberta' layer not properly initialized. Am I wrong in somewhere?
Hello, I'm facing the same issue. Do you find any solutions ? :)<|||||>Hello, facing the same problem<|||||>cc @Rocketknight1 @gante :raised_hands: <|||||>Directly using `TFRobertaMainLayer` is unusual and not recommended - @jessiewang158 can you try using `TFRobertaModel` instead?<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.