transformers is incompatible with Tensorflow nightly build version
Author: WeichenXu123
Pull request: no

### System Info

Python version: 3.7
TF branch: dev (installed by `pip install tf-nightly`)
transformers version: 4.27.3




### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

```
from transformers import TFBertModel
```

then got error like:

```
Traceback (most recent call last):
  File "/Users/weichen.xu/opt/miniconda3/envs/py38/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 1126, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/Users/weichen.xu/opt/miniconda3/envs/py38/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/weichen.xu/opt/miniconda3/envs/py38/lib/python3.8/site-packages/transformers/models/bert/modeling_tf_bert.py", line 38, in <module>
    from ...modeling_tf_utils import (
  File "/Users/weichen.xu/opt/miniconda3/envs/py38/lib/python3.8/site-packages/transformers/modeling_tf_utils.py", line 69, in <module>
    from keras.engine import data_adapter
ModuleNotFoundError: No module named 'keras.engine'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "/Users/weichen.xu/opt/miniconda3/envs/py38/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 1117, in __getattr__
    value = getattr(module, name)
  File "/Users/weichen.xu/opt/miniconda3/envs/py38/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 1116, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/Users/weichen.xu/opt/miniconda3/envs/py38/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 1128, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.models.bert.modeling_tf_bert because of the following error (look up to see its traceback):
No module named 'keras.engine'
```

### Expected behavior

The importing command should not raise error.

Comments:
cc @Rocketknight1 and @gante

Hey @WeichenXu123 👋 

I get a slightly different (but related) error when I create the `tf-nightly` environment on my end. They may be changing a few things in the namespace (like they did with `keras.saving` in TF 2.12), so the wise decision here is to wait few days before committing to a fix :)

```
>>> from transformers import TFBertModel
2023-03-28 15:03:57.852621: E tensorflow/tsl/lib/monitoring/collection_registry.cc:81] Cannot register 2 metrics with the same name: /tensorflow/api/keras/data_adapters
Traceback (most recent call last):
  File "/home/joao/transformers/src/transformers/utils/import_utils.py", line 1125, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/joao/transformers/src/transformers/models/bert/modeling_tf_bert.py", line 38, in <module>
    from ...modeling_tf_utils import (
  File "/home/joao/transformers/src/transformers/modeling_tf_utils.py", line 69, in <module>
    from keras.engine import data_adapter
  File "/home/joao/tf_nightly_venv/lib/python3.10/site-packages/keras/engine/data_adapter.py", line 47, in <module>
    keras_data_adapter_gauge = tf.__internal__.monitoring.BoolGauge(
  File "/home/joao/tf_nightly_venv/lib/python3.10/site-packages/tensorflow/python/eager/monitoring.py", line 356, in __init__
    super(BoolGauge, self).__init__('BoolGauge', _bool_gauge_methods,
  File "/home/joao/tf_nightly_venv/lib/python3.10/site-packages/tensorflow/python/eager/monitoring.py", line 131, in __init__
    self._metric = self._metric_methods[self._label_length].create(*args)
tensorflow.python.framework.errors_impl.AlreadyExistsError: Another metric with the same name already exists.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "/home/joao/transformers/src/transformers/utils/import_utils.py", line 1116, in __getattr__
    value = getattr(module, name)
  File "/home/joao/transformers/src/transformers/utils/import_utils.py", line 1115, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/home/joao/transformers/src/transformers/utils/import_utils.py", line 1127, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.models.bert.modeling_tf_bert because of the following error (look up to see its traceback):
Another metric with the same name already exists.
```

Seconding @gante's comment here - TF 2.12 is very recent, and the nightly branch for 2.13 is likely to have multiple changes before release. We don't want to modify `transformers` until the TF team have committed to their API changes and we see a beta or RC0 release.

Closing this for now, but feel free to ping us and reopen this issue if a beta or release candidate version appears and the incompatibilities are still there!


> Seconding @gante's comment here - TF 2.12 is very recent, and the nightly branch for 2.13 is likely to have multiple changes before release. We don't want to modify `transformers` until the TF team have committed to their API changes and we see a beta or RC0 release.
> 
> Closing this for now, but feel free to ping us and reopen this issue if a beta or release candidate version appears and the incompatibilities are still there!

Sounds good, it is not urgent. :)