Tflite convertion with pretrained-weight

Hi , I have pre-trained weight for lung cancer type classification. Model.h5 config.yaml and test_result.json files are prepared. But I dont know how to convert this model into tflite.

import tensorflow as tf

model = tf.keras.models.load_model('/content/drive/MyDrive/model.h5')
converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()
open("tflitemodel.tflite", "wb").write(tflite_model)

when I try to use this code I get an error like ValueError: No model config found in the file . Im really confused right now. Can someone please help me how can I use these files to have an tflite file?

It is because your h5 file only contains weights. You need to save your model architecture in a json file and then use model_from_json to load the model configuration. Therefore you can load weights with load_weights. Thank you.