Search code examples
iosmachine-learningmodelscoreml

Is it possible to upload .mlmodel files over wifi insetad of having them embedded?


I'm planning to use some models with over 500MB size and I don't want them embedded otherwise my app will be huge which is not really desirable.

Thanks,


Solution

  • This is possible. After downloading the model, compile it using:

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

    The compiled model will be stored in a temporary location. After compilation completes, you should move it to a permanent location.