Keras / Tensorflow why saving a subclassed model is hard
Very nice R-centric explanation, but should be valid for Python too: Saving and serializing models
A subclassed model differs in that it’s not a data structure, it’s a piece of code. The architecture of the model is defined via the body of the call method. This means that the architecture of the model cannot be safely serialized. To load a model, you’ll need to have access to the code that created it (the code of the model subclass). Alternatively, you could be serializing this code as bytecode (e.g. via pickling), but that’s unsafe and generally not portable.
TODO Tensorflow model saving / prediction
Why am I getting wildly different accuracies and losses after loading the model from
.h5 file, when
model.weights for both are identical and predictions (using
model.predict()) too? This probably has something to do with me misunderstanding datasets, how exactly?