Saved model won't load: Unable to synchronously open object (bad local heap signature)
Some sample code
```
import tensorflow as tf
from tensorflow.keras.layers import TextVectorization

data = [
    "The sky is blue.",
    "Grass is green.",
]

# Create vectorizer
text_dataset = tf.data.Dataset.from_tensor_slices(data)
vectorizer = TextVectorization(
    max_tokens=1000, output_mode='tf-idf', ngrams=None,
)
vectorizer.adapt(text_dataset.batch(1024))

# Create model
model = tf.keras.models.Sequential()
model.add(tf.keras.Input(shape=(1,), dtype=tf.string))
model.add(vectorizer)

print (vectorizer("sky is blue"))

# Save
filepath = "my_model.keras"
# .tf not work, .h5 not work, .keras not work
model.save(filepath)

# Load
loaded_model = tf.keras.models.load_model(filepath)
loaded_vectorizer = loaded_model.layers[0]

print (loaded_vectorizer("sky is blue"))
```

Any ideas how to save the model with TextVectorizer in tensorflow 2.16.1 now? Hi **@Expert73** ,

Sorry for the dealy, I reproduced the code you shared. Here i am providing [gist](https://colab.sandbox.google.com/gist/Venkat6871/8d20d7d01900b8be55662d751c91b80f/63365_2-16-1-v.ipynb) for how to save the model with TextVectorizer in tensorflow 2.16.1 for your reference. please go through it once.

Thank you! > Hi **@Expert73** ,
> 
> Sorry for the dealy, I reproduced the code you shared. Here i am providing [gist](https://colab.sandbox.google.com/gist/Venkat6871/8d20d7d01900b8be55662d751c91b80f/63365_2-16-1-v.ipynb) for how to save the model with TextVectorizer in tensorflow 2.16.1 for your reference. please go through it once.
> 
> Thank you!

Colab work fine. But in windows 10:
```
D:\project_1\venv\Scripts\python.exe D:\project_1\test.py 
2024-03-21 20:54:53.563758: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-03-21 20:54:54.181494: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2.16.1
2024-03-21 20:54:55.382961: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 250ms/step - loss: 0.5000
Traceback (most recent call last):
  File "D:\project_1\test.py", line 47, in <module>
    loaded_model = tf.keras.models.load_model("my_model_with_vectorizer.keras")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\project_1\venv\Lib\site-packages\keras\src\saving\saving_api.py", line 176, in load_model
    return saving_lib.load_model(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\project_1\venv\Lib\site-packages\keras\src\saving\saving_lib.py", line 192, in load_model
    _raise_loading_failure(error_msgs)
  File "D:\project_1\venv\Lib\site-packages\keras\src\saving\saving_lib.py", line 273, in _raise_loading_failure
    raise ValueError(msg)
ValueError: A total of 1 objects could not be loaded. Example error message for object <keras.src.optimizers.adam.Adam object at 0x00000214B810A8A0>:

'Unable to synchronously open object (bad object header version number)'

List of objects that could not be loaded:
[<keras.src.optimizers.adam.Adam object at 0x00000214B810A8A0>]

Process finished with exit code 1
```
Windows 10 x64
Python 3.12
Tensorflow 2.16.1

colab
python 3.10.12 (!)
Tensorflow 2.16.1

Update:
test with python 3.10 and 3.11, tensorflow 2.16.1 in windows - work fine.

problem with python 3.12 (!)

how can I solve the problem?
 Problem still with python 3.12 > > Hi **@Expert73** ,
> > Sorry for the dealy, I reproduced the code you shared. Here i am providing [gist](https://colab.sandbox.google.com/gist/Venkat6871/8d20d7d01900b8be55662d751c91b80f/63365_2-16-1-v.ipynb) for how to save the model with TextVectorizer in tensorflow 2.16.1 for your reference. please go through it once.
> > Thank you!
> 
> Colab work fine. But in windows 10:
> 
> ```
> D:\project_1\venv\Scripts\python.exe D:\project_1\test.py 
> 2024-03-21 20:54:53.563758: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
> 2024-03-21 20:54:54.181494: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
> 2.16.1
> 2024-03-21 20:54:55.382961: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
> To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
> 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 250ms/step - loss: 0.5000
> Traceback (most recent call last):
>   File "D:\project_1\test.py", line 47, in <module>
>     loaded_model = tf.keras.models.load_model("my_model_with_vectorizer.keras")
>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "D:\project_1\venv\Lib\site-packages\keras\src\saving\saving_api.py", line 176, in load_model
>     return saving_lib.load_model(
>            ^^^^^^^^^^^^^^^^^^^^^^
>   File "D:\project_1\venv\Lib\site-packages\keras\src\saving\saving_lib.py", line 192, in load_model
>     _raise_loading_failure(error_msgs)
>   File "D:\project_1\venv\Lib\site-packages\keras\src\saving\saving_lib.py", line 273, in _raise_loading_failure
>     raise ValueError(msg)
> ValueError: A total of 1 objects could not be loaded. Example error message for object <keras.src.optimizers.adam.Adam object at 0x00000214B810A8A0>:
> 
> 'Unable to synchronously open object (bad object header version number)'
> 
> List of objects that could not be loaded:
> [<keras.src.optimizers.adam.Adam object at 0x00000214B810A8A0>]
> 
> Process finished with exit code 1
> ```
> 
> Windows 10 x64 Python 3.12 Tensorflow 2.16.1
> 
> colab python 3.10.12 (!) Tensorflow 2.16.1
> 
> Update: test with python 3.10 and 3.11, tensorflow 2.16.1 in windows - work fine.
> 
> problem with python 3.12 (!)
> 
> how can I solve the problem?

you are the best bro!! @Expert73 try Python 3.12.2.

Almost the same issue when I used Python 3.12.0 + Keras 3.1.1 + TensorFlow 2.16.1
```
ValueError: A total of 1 objects could not be loaded. Example error message for object <keras.src.optimizers.rmsprop.RMSprop object at 0x12732ec30>:

'Unable to open object (bad object header version number)'

List of objects that could not be loaded:
[<keras.src.optimizers.rmsprop.RMSprop object at 0x12732ec30>]
```
When I changed my Python version from `3.12.0` to `3.12.2`, it worked well. > @Expert73 try Python 3.12.2.
> 
> Almost the same issue when I used Python 3.12.0 + Keras 3.1.1 + TensorFlow 2.16.1
> 
> ```
> ValueError: A total of 1 objects could not be loaded. Example error message for object <keras.src.optimizers.rmsprop.RMSprop object at 0x12732ec30>:
> 
> 'Unable to open object (bad object header version number)'
> 
> List of objects that could not be loaded:
> [<keras.src.optimizers.rmsprop.RMSprop object at 0x12732ec30>]
> ```
> 
> When I changed my Python version from `3.12.0` to `3.12.2`, it worked well.

@Venkat6871  > When I changed my Python version from `3.12.0` to `3.12.2`, it worked well.

Thanks for the info. I checked too. Everything works great! Hi **@Expert73** ,
- Great to see it is working well to you. Could you please confirm if this issue is resolved for you ? Please feel free to close the issue if it is resolved.

Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/63365">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/63365">No</a>

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

binary

### TensorFlow version

2.16.1

### Custom code

Yes

### OS platform and distribution

windows 10

### Mobile device

_No response_

### Python version

3.12

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

Model saved from Python 3.12 tensorflow 2.16.1
model.save('my_model.keras', overwrite=True)

After this the model does not load

### Standalone code to reproduce the issue

```shell
model=tf.keras.models.load_model('my_model.keras', custom_objects=None, compile=True, safe_mode=True)
```


### Relevant log output

```shell
Traceback (most recent call last):
  File "D:\Project\main.py", line 391, in <module>
    model=tf.keras.models.load_model('my_model.keras', custom_objects=None, compile=True, safe_mode=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Project\venv\Lib\site-packages\keras\src\saving\saving_api.py", line 176, in load_model
    return saving_lib.load_model(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Project\venv\Lib\site-packages\keras\src\saving\saving_lib.py", line 192, in load_model
    _raise_loading_failure(error_msgs)
  File "D:\Project\venv\Lib\site-packages\keras\src\saving\saving_lib.py", line 273, in _raise_loading_failure
    raise ValueError(msg)
ValueError: A total of 13 objects could not be loaded. Example error message for object <Sequential name=sequential, built=True>:

'Unable to synchronously open object (bad local heap signature)'

List of objects that could not be loaded:
[<Sequential name=sequential, built=True>, <TextVectorization name=text_vectorization, built=True>, <StringLookup name=string_lookup_1, built=False>, <Embedding name=embedding, built=True>, <Conv1D name=conv1d, built=True>, <Dropout name=dropout, built=True>, <Conv1D name=conv1d_1, built=True>, <Dropout name=dropout_1, built=True>, <GlobalMaxPooling1D name=global_max_pooling1d, built=True>, <Dense name=dense, built=True>, <Dropout name=dropout_2, built=True>, <Dense name=dense_1, built=True>, <keras.src.optimizers.adam.Adam object at 0x000001C5026B24E0>]
```
