Created
August 5, 2024 17:17
-
-
Save sherwoac/180438367d4ca009e3672632247dac30 to your computer and use it in GitHub Desktop.
scripts to change model config from keras 2->3 compliant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hack to change model config from keras 2->3 compliant | |
import h5py | |
f = h5py.File(savedModelPath, mode="r+") | |
model_config_string = f.attrs.get("model_config") | |
if model_config_string.find('"groups": 1,') != -1: | |
model_config_string = model_config_string.replace('"groups": 1,', '') | |
f.attrs.modify('model_config', model_config_string) | |
f.flush() | |
model_config_string = f.attrs.get("model_config") | |
assert model_config_string.find('"groups": 1,') == -1 | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment