import json # lets assume `model` is main model model_json = model.to_json() with open("model_in_json.json", "w") as json_file: json.dump(model_json, json_file) model.save_weights("model_weights.h5")