Can't Save TFHubertForCTC  as Saved_model
Author: ahmedlone127
Pull request: no

### System Info

- `transformers` version: 4.25.1
- Platform: Linux-5.10.133+-x86_64-with-glibc2.27
- Python version: 3.8.16
- Huggingface_hub version: 0.11.1
- PyTorch version (GPU?): 1.13.0+cu116 (True)
- Tensorflow version (GPU?): 2.9.2 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: I am running on colab 


### Who can help?

@Rocketknight1 @gante

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction


```
from transformers import Wav2Vec2Processor, TFHubertForCTC

model = TFHubertForCTC.from_pretrained("facebook/hubert-large-ls960-ft")
model.save("test")

```


```

Downloading: 100%
1.38k/1.38k [00:00<00:00, 53.4kB/s]
Downloading: 100%
1.26G/1.26G [00:32<00:00, 72.2MB/s]

TFHubertForCTC has backpropagation operations that are NOT supported on CPU. If you wish to train/fine-tine this model, you need a GPU or a TPU
All model checkpoint layers were used when initializing TFHubertForCTC.

All the layers of TFHubertForCTC were initialized from the model checkpoint at facebook/hubert-large-ls960-ft.
If your task is similar to the task the model of the checkpoint was trained on, you can already use TFHubertForCTC for predictions without further training.
---------------------------------------------------------------------------
OperatorNotAllowedInGraphError            Traceback (most recent call last)
[<ipython-input-2-d87cdca07c35>](https://localhost:8080/#) in <module>
      2 
      3 model = TFHubertForCTC.from_pretrained("facebook/hubert-large-ls960-ft")
----> 4 model.save("test")

4 frames
[/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py](https://localhost:8080/#) in error_handler(*args, **kwargs)
     65     except Exception as e:  # pylint: disable=broad-except
     66       filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67       raise e.with_traceback(filtered_tb) from None
     68     finally:
     69       del filtered_tb

[/usr/lib/python3.8/contextlib.py](https://localhost:8080/#) in __exit__(self, type, value, traceback)
    118         if type is None:
    119             try:
--> 120                 next(self.gen)
    121             except StopIteration:
    122                 return False

[/usr/local/lib/python3.8/dist-packages/transformers/models/hubert/modeling_tf_hubert.py](https://localhost:8080/#) in call(self, input_values, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, output_attentions, output_hidden_states, return_dict, training, **kwargs)
   1260         mask_time_indices = kwargs.get("mask_time_indices", None)
   1261         if inputs["training"]:
-> 1262             hidden_states = self._mask_hidden_states(hidden_states, mask_time_indices=mask_time_indices)
   1263 
   1264         encoder_outputs = self.encoder(

[/usr/local/lib/python3.8/dist-packages/transformers/models/hubert/modeling_tf_hubert.py](https://localhost:8080/#) in _mask_hidden_states(self, hidden_states, mask_time_indices)
   1191         elif self.config.mask_time_prob > 0:
   1192             # generate indices & apply SpecAugment along time axis
-> 1193             mask_time_indices = _compute_mask_indices(
   1194                 (batch_size, sequence_length),
   1195                 mask_prob=self.config.mask_time_prob,

[/usr/local/lib/python3.8/dist-packages/transformers/models/hubert/modeling_tf_hubert.py](https://localhost:8080/#) in _compute_mask_indices(shape, mask_prob, mask_length, min_masks)
    222         raise ValueError("`mask_length` has to be bigger than 0.")
    223 
--> 224     if mask_length > sequence_length:
    225         raise ValueError(
    226             f"`mask_length` has to be smaller than `sequence_length`, but got `mask_length`: {mask_length} and"

OperatorNotAllowedInGraphError: Using a symbolic `tf.Tensor` as a Python `bool` is not allowed: AutoGraph did convert this function. This might indicate you are trying to use an unsupported feature.

```



### Expected behavior

This code should save the model as a tensorflow Saved_Model, this code works for version 4.22.2. Also by chanigng the value of sequence_length to some random value such as 100 in the soure code , it started working. 

Comments:
Hey @ahmedlone127 👋 I was able to reproduce locally on the latest version, will look into its causes!

@ahmedlone127: #20966 should fix it after it is merged 🤗

Two notes:
1 - You would have to install `transformers` from git (`pip install https://github.com/huggingface/transformers`)
2 - Your example script has some warnings after including the fix. There is a chance that the loaded model does not have the functionality you wish, you'd have to try it out :)