Fail to write model history to a json file in the end of 2nd epoch of a keras fit_generator training Fail to write model history to a json file in the end of 2nd epoch of a keras fit_generator training numpy numpy

Fail to write model history to a json file in the end of 2nd epoch of a keras fit_generator training


problem solved by changing "l.append(v)" to "l.append(float(v))". The error is because that data type of "lr" is numpy.float32 and json's encoder might not be able to encode it. Below shows data type has been changed to native Python float type then no problem to be written into json.

acc <class 'numpy.float64'>acc <class 'float'>lr <class 'numpy.float32'>lr <class 'float'>