TFlite model signature lost after populating with metadata
Is there any solution/comment on this ? @tensorflower-gardener @mihaimaruseac Hi @ pkgoogle,
Please look into the issue.

Thank You Hi @pucha48, can you either upload your model file or show us the code that produces the model? Feel free to simplify or reduce the model so that it just shows the issue. Thanks for your help. @pkgoogle I have added a sample code in zip, showing the sample issue. Please have a look.

[Archive.zip](https://github.com/tensorflow/tensorflow/files/13781408/Archive.zip)
 I was able to reproduce in this [gist](https://colab.sandbox.google.com/gist/pkgoogle/8dc470cb1c235a5831dc592eb9d844d7/62620.ipynb).

If I try with tf-nightly, it crashes in the 2nd cell
If I try with tflite-support (without the specific version) there is a name/package collision when importing flatbuffers

It appears to remove the signatures and writes to the file during this call:
```
populator = _metadata.MetadataPopulator.with_model_file(model_path)
```

Hi @miaout17, can you please take a look? Thanks.
### 1. System information

- Mac OS 14.1.2
- TensorFlow mac 2.13.0
- Tflite support version '0.1.0a1'

### 2. Code

```
def write_metadata(model_path, run_name):
    model_meta = _metadata_fb.ModelMetadataT()
    model_meta.name = "test model"
    model_meta.description = run_name
    model_meta.version = datetime.now().strftime("%Y.%m.%d")
    model_meta.author = "Test"
    model_meta.license = f"test"\
        "All rights reserved - test"

    input_meta_image = _metadata_fb.TensorMetadataT()
    input_meta_image.description = "Input image for which to score doneness."
    input_meta_image.content = _metadata_fb.ContentT()
    input_meta_image.content.contentProperties = _metadata_fb.ImagePropertiesT()
    input_meta_image.content.contentProperties.colorSpace = _metadata_fb.ColorSpaceType.RGB
    input_meta_image.content.contentPropertiesType = _metadata_fb.ContentProperties.ImageProperties

    input_meta_state = _metadata_fb.TensorMetadataT()
    input_meta_state.description = "Input state."
    input_meta_state.name = "Input state."

    # Creates output info.
    output_meta_doneness = _metadata_fb.TensorMetadataT()
    output_meta_doneness.description = "Output doneness score between 0 and 1."
    output_meta_doneness.name = "Output Doneness"

    output_meta_state = _metadata_fb.TensorMetadataT()
    output_meta_state.description = "Output state."
    output_meta_state.name = "Output state."

    subgraph = _metadata_fb.SubGraphMetadataT()

    interpreter = tf.lite.Interpreter(model_path)
    input_details = interpreter.get_input_details()
    output_details = interpreter.get_output_details()
    state_first_input = input_details[0]['shape'][-1] != 3
    state_first_output = output_details[0]['shape'][-1] != 1

    input_meta = [input_meta_state, input_meta_image]
    output_meta = [output_meta_state, output_meta_doneness]

    subgraph.inputTensorMetadata = input_meta if state_first_input else input_meta[::-1]
    subgraph.outputTensorMetadata = output_meta if state_first_output else output_meta[::-1]

    model_meta.subgraphMetadata = [subgraph]
    b = flatbuffers.Builder(0)
    b.Finish(
        model_meta.Pack(b),
        _metadata.MetadataPopulator.METADATA_FILE_IDENTIFIER)
    metadata_buf = b.Output()

    populator = _metadata.MetadataPopulator.with_model_file(model_path)
    populator.load_metadata_buffer(metadata_buf)
    populator.populate()

```

I am using above function to populate the metadata. without running above function getting signature output like 

```
interpreter.get_signature_list()
{'serving_default': {'inputs': ['input_image', 'input_state'], 'outputs': ['output_1', 'output_2']}}
```

after running metadata function 
```
interpreter.get_signature_list()
{}
```


