apple / turicreate

Turi Create simplifies the development of custom machine learning models.
BSD 3-Clause "New" or "Revised" License
11.2k stars 1.14k forks source link

Expose model.export_coreml as binary object that can be pickled by native python pickler. #2261

Open skirdey opened 5 years ago

skirdey commented 5 years ago

Hey folks, is it possible to expose a trained model as binary object that I can pickle myself? My use case is to save and load Turicreate models to and from S3, where loading is only used for inference. It seems like coreml produces single file? Would be great to have a way to get a binary of a model that can be pickled with native python pickler. Thanks!

TobyRoseman commented 5 years ago

I just tried and much to my surprise it seems you can not pickle either a mlmodel or the spec for an mlmodel. I get the following error: PicklingError: Can't pickle <class 'Model_pb2.Model'>: import of module 'Model_pb2' failed.

@skirdey - Is there a reason you can't call save(...) on the turicreate model (not the mlmodel)? I believe you should be able to pass save an S3 path.

skirdey commented 5 years ago

I have a custom saving mechanism that saves to a location in s3 that I do not control neither know beforehand, having a binary would simplify distributed computing part of using turicreate.