Can't save DistilBert model.
Model:
```
input_layer = tf.keras.layers.Input(shape = (attention_mask.shape[1],), dtype='int64')
bert = TFDistilBertModel.from_pretrained("distilbert-base-cased")(input_layer)
bert = bert[0][:,0,:]              
bert = tf.keras.layers.Dense(units=20, activation='relu')(bert)
classifier = tf.keras.layers.Dense(units=train_y.shape[1], activation='softmax')(bert)
model = tf.keras.models.Model(inputs=input_layer, outputs=classifier)
model.summary()
```

After training when I try to save the model using:
```
# serialize model to JSON
model_json = model.to_json()
with open("model.json", "w") as json_file:
    json_file.write(model_json)
# serialize weights to HDF5
model.save_weights("model.h5")
print("Saved model to disk")
```

I am getting this error:
```
File "train_DistilBERT_model.py", line 138, in <module>
    model_json = model.to_json()
  File "/home/v-mohit.saini/anaconda3/envs/flask/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/network.py", line 1254, in to_json
    model_config = self._updated_config()
  File "/home/v-mohit.saini/anaconda3/envs/flask/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/network.py", line 1232, in _updated_config
    config = self.get_config()
  File "/home/v-mohit.saini/anaconda3/envs/flask/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/network.py", line 918, in get_config
    return copy.deepcopy(get_network_config(self))
  File "/home/v-mohit.saini/anaconda3/envs/flask/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/network.py", line 1993, in get_network_config
    layer_config = serialize_layer_fn(layer)
  File "/home/v-mohit.saini/anaconda3/envs/flask/lib/python3.6/site-packages/tensorflow_core/python/keras/utils/generic_utils.py", line 198, in serialize_keras_object
    config = instance.get_config()
  File "/home/v-mohit.saini/anaconda3/envs/flask/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/network.py", line 917, in get_config
    raise NotImplementedError
NotImplementedError
```

How to fix this?
Could you provide all the information related to your environment as the bug template recommends?

Can you try installing from master? In the latest pypi version, we only handled the `save_pretrained` method, not the `save`/`save_weights` methods. This should have been changed with #3103.<|||||>The changes in #3103 only address serialization of `TF*MainLayer` classes, used within a general Functional/Sequential API Keras model (which was my use case). Looking at [the Network docstring](https://github.com/tensorflow/tensorflow/blob/5c4931bbf69e0f006f210c6382a234e83dd4dc8e/tensorflow/python/keras/engine/network.py#L89-L97) it seems like the `TF*Model` classes, being “subclass models”, need more work in order to support Keras serialization.<|||||>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.
