Skip to content

Instantly share code, notes, and snippets.

@davecg
davecg / fix_keras_model.py
Last active April 9, 2017 00:00 — forked from mgraczyk/fix_keras_model.py
Fix input_dtype errors in pre-2.0 keras model H5FS files
import h5py
import shutil
import json
import sys
def fix_weight_file(model_path):
with h5py.File(model_path, "r+") as out_h5:
v = out_h5.attrs.get("model_config")
config = json.loads(v)