RoBERTa required token_type_ids issue
Author: Sion1225
Pull request: no

### System Info

- `transformers` version: 4.30.2
- Platform: Windows-10-10.0.19041-SP0
- Python version: 3.9.0
- Huggingface_hub version: 0.15.1
- Safetensors version: 0.3.1
- PyTorch version (GPU?): 2.0.1+cpu (False)
- Tensorflow version (GPU?): 2.10.0 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

@ArthurZucker @younesbelkada @gante 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

```python
class TF_RoBERTa_VAD_Classification(tf.keras.Model):
    def __init__(self, model_name):
        super(TF_RoBERTa_VAD_Classification, self).__init__()

        self.model_name = model_name
        self.roberta = TFRobertaModel.from_pretrained(model_name, from_pt=True, return_dict=False)

        self.predict_V_1 = tf.keras.layers.Dense(1, kernel_initializer=tf.keras.initializers.TruncatedNormal(0.02), activation="linear", name="predict_V_1") # Initializer function test
        self.predict_A_1 = tf.keras.layers.Dense(1, kernel_initializer=tf.keras.initializers.TruncatedNormal(0.02), activation="linear", name="predict_A_1")
        self.predict_D_1 = tf.keras.layers.Dense(1, kernel_initializer=tf.keras.initializers.TruncatedNormal(0.02), activation="linear", name="predict_D_1")

        # Learn Correlation Layers
        self.Corr_layer = tf.keras.models.load_model("Assinging_VAD_scores_BERT\Model\FFNN_VAD_Model_ver1_MSE_00048_20230625-231002") # <<<<< Change the model

    
    def call(self, inputs):
        input_ids, attention_mask = inputs

        outputs = self.roberta(input_ids=input_ids, attention_mask=attention_mask)
        cls_token = outputs[1]

        self.V_1 = self.predict_V_1(cls_token)
        self.A_1 = self.predict_A_1(cls_token)
        self.D_1 = self.predict_D_1(cls_token)

        VAD_1 = tf.concat([self.V_1, self.A_1, self.D_1], 1) # 0: up-down 1: side
        final_outputs = self.Corr_layer(VAD_1)

        return final_outputs

    def get_config(self):
        config = super().get_config()
        config.update({
            "model_name": self.model_name,
            "Corr_layer_config": self.Corr_layer.get_config()
        })
        return config

    @classmethod
    def from_config(cls, config):
        return cls(**config)
```
This is my model with RoBERTa and I trained model and saved this.
And I loaded model and when I tried to get predicted value,
```python
# Load trained model
custom_objects = {"model_name": TF_RoBERTa_VAD_Classification,
                  "FFNN_VAD_model": FFNN_VAD_model}
model = tf.keras.models.load_model("Assinging_VAD_scores_BERT\Model\VAD_Assinging_RoBERTa_model_ver1.2_20230626-142030", custom_objects=custom_objects, compile=False)

pred = model.predict((id, mask))[0][0]
```



### Expected behavior

the error is occurred
```
Traceback (most recent call last):
  File "c:\Users\Siwon\Documents\GitHub\Assinging_VAD_scores_BERT\Test_model.py", line 122, in <module>
f.int32, name=None)}, None, None, None, None, None, None, None, None, None, None, None, None, False), {})

Second structure: type=tuple str=((TensorSpec(shape=(None, 512), dtype=tf.int32, name='input_ids'), TensorSpec(shape=(None, 512), dtype=tf.int32, name='attention_mask'), None, None, None, None, None, None, None, None, None, None, None, False), {})

More specifically: Substructure "type=dict str={'attention_mask': TensorSpec(shape=(None, None), dtype=tf.int32, name=None), 'token_type_ids': TensorSpec(shape=(None, None), dtype=tf.int32, name=None), 'input_ids': TensorSpec(shape=(None, None), dtype=tf.int32, name=None)}" is a sequence, while substructure "type=TensorSpec str=TensorSpec(shape=(None, 512), dtype=tf.int32, name='input_ids')" is not
Entire first structure:
(({'attention_mask': ., 'token_type_ids': ., 'input_ids': .}, ., ., ., ., ., ., ., ., ., ., ., ., .), {})
Entire second structure:
((., ., ., ., ., ., ., ., ., ., ., ., ., .), {})
```
The error occurred `model = tf.keras.models.load_model("Assinging_VAD_scores_BERT\Model\VAD_Assinging_RoBERTa_model_ver1.2_20230626-155718", custom_objects=custom_objects, compile=False) ` this part But, 
This is looks like model requested token_type_ids even if RoBERTa model doesn't require token_type_ids.

I humbly request, if anyone knows a solution, could you please inform me? I would be grateful for your assistance. 
Thank you.

Comments:
It was solved.
code should be 
```python
def get_config(self):
        config = super().get_config()
        config.update({
            "model_name": self.model_name,
            "Corr_layer_config": self.Corr_layer_path  # suppose Corr_layer_path is the variable that holds the path to Corr_layer
        })
        return config

    @classmethod
    def from_config(cls, config):
        model = cls(config["model_name"])
        model.Corr_layer = tf.keras.models.load_model(config["Corr_layer_config"])
        return model
```
sorry for interrupt. thank you! 

Thanks for solving this yourself! 😉