Cerise
Cerise

Reputation: 403

Re-importing mlmodel in CreateML

I'm testing the new awesome CreateML in an XCode playground. I used the MLImageClassifierBuilder() with the live view feature to create my model, and saved it. Now I would like to re-import my .mlmodel file into my playground to run some more tests, but I didn't found a way to do it.

This seemed obvious to me to find this capability when I closed my playground.

Upvotes: 2

Views: 464

Answers (1)

Matthijs Hollemans
Matthijs Hollemans

Reputation: 7902

You can't continue training the same mlmodel. However, you can load the existing mlmodel and use it via the MLModel API, like so:

let compiledUrl = try MLModel.compileModel(at: modelUrl)
let model = try MLModel(contentsOf: compiledUrl)
model.prediction(....)

Never tried it myself, so I'm not 100% sure this works from a playground.

Upvotes: 1

Related Questions