I'm trying to implement the new CoreML 3 feature of updatable Models into my App, but I can't figure it out.
Im creating a Neural Network with 2 layers in Keras and convert it to a core ML Model. Then I include the model into my iOS Project.
However self.testmodel.model.modelDescription.isUpdatable
is always false, and I can't make sense of the apple docs.
model = Sequential([
Dense(10, activation="sigmoid", input_shape=(2,)),
Dense(2, activation="relu"),
])
core_mlmodel = coremltools.converters.keras.convert(model)
core_mlmodel.save("FirstNN.mlmodel")
Integrated in Swift I can now use the Model, but can't update it
let testmodel = FirstNN()
try testmodel.prediction(input: input) // works
testmodel.model.modelDescription.isUpdatable // is false
Why isn't my model updatable and how can I change that?
You can pass the respect_trainable=True
argument to coremltools.converters.keras.convert()
.
Alternatively, you can change the mlmodel file after the conversion to make the model updatable. Official documentation in the form of examples is here: https://github.com/apple/coremltools/tree/master/examples/updatable_models