Week 4 Assignment 1 3.1 model won't load - "bad marshal data"

When I run the follow code on my own computer I get “bad marshal data” error.

from tensorflow.keras.models import model_from_json

json_file = open('keras-facenet-h5/model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
model = model_from_json(loaded_model_json)
model.load_weights('keras-facenet-h5/model.h5')

Output:
--------------------------------------------------------------------------- ValueError Traceback
in func_load(code, defaults, closure, globs) 101 except (UnicodeEncodeError, binascii.Error): 102 raw_code = code.encode(“raw_unicode_escape”) → 103 code = marshal.loads(raw_code) 104 if globs is None: 105 globs = globals() ValueError: bad marshal data (unknown type code)

My Python version is 3.10.10

This means you have version compatibility issues. To replicate the assignments on your local system, you need the same versions of libraries as used by the course. Here is the guide. You may want to check this too.

Thanks. This worked.