Closed chrisbarber closed 3 years ago
ok the history is somewhat related to the #6 task so lets just have that in the backlog for a while. strictly speaking if we just look at keras, we could use the to_json() but that needs a transcriber into MLS format.
note there's a problem with that to_json(), as in for example it does not contain what's the optimizer you are using, nor the loss function:
import tensorflow
from tensorflow.keras.optimizers import RMSprop
inputs = tensorflow.keras.Input(shape=(3,))
x = tensorflow.keras.layers.Dense(4, activation=tensorflow.nn.relu)(inputs)
outputs = tensorflow.keras.layers.Dense(5, activation=tensorflow.nn.softmax)(x)
model = tensorflow.keras.Model(inputs=inputs, outputs=outputs)
optimizer = RMSprop(lr=0.01)
model.compile(optimizer=optimizer, loss='mae')
is a quite simple example. if you check model.to_json()
it will only contain the layers but not the optimizer.
one can have access to optimizer's config by model.optimizer.get_config()
, but looking at keras' api i was trying to find a way where one could get all these infos (layers, optimizers etc) as one so we could just generate the MLS format using that.
Took a quick look at what is inside the SavedModel file. It definitely has everything in it but it looks maybe too verbose; so I guess I lean towards just using model.optimizer.get_config()
, unless a 3rd option becomes known..?
parsed contents of SavedModel .pb file
Just to clarify @vigsterkr , since I am not familiar, is keras fine as a target for this for now? It seems like raw tensorflow is maybe too low level to expect to be able to convert to mls.
keras models have
to_json
:test round trip:
after
fit
the json is the same however. thetensorflow.python.keras.callbacks.History
object returned bymodel.fit
has some stuff in it: