Turicreate: Error reading protobuf spec. validator error: The .mlmodel supplied is of version 3, intended for a newer version of Xcode. This version of Xcode supports model version 2 or earlier.".

Created on 16 Jun 2018  路  7Comments  路  Source: apple/turicreate

I'm getting the above error when trying to run:
model.export_coreml('MyCustomObjectDetector.mlmodel')

model.export_coreml('MyCustomObjectDetector.mlmodel')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/amir/anaconda/envs/CVision/lib/python2.7/site-packages/turicreate/toolkits/object_detector/object_detector.py", line 1477, in export_coreml
    mlmodel = coremltools.models.MLModel(model)
  File "/Users/amir/anaconda/envs/CVision/lib/python2.7/site-packages/coremltools/models/model.py", line 209, in __init__
    self.__proxy__ = _get_proxy_from_spec(filename)
  File "/Users/amir/anaconda/envs/CVision/lib/python2.7/site-packages/coremltools/models/model.py", line 103, in _get_proxy_from_spec
    return _MLModelProxy(filename)

I'm on coremltools 2.0b1
pip 9.0.1
turicreate 5.0b1
python 2.7.13
Xcode 10.0 beta
macOS High Sierra 10.13.4

Not sure what to do, I wish the error would be more descriptive about what one should do in order to resolve this.

Core ML bug object detection p2

All 7 comments

@amiraeitan This message means that Turi Create tried to save a model, while running on macOS 10.13, that isn't actually compatible with macOS 10.13. This seems like a bug, assuming we should be able to export object detector models that run on 10.13.

@gustavla Is it expected that a 5.0b1 object detector model, when exported to Core ML, requires Xcode 10+ (macOS 10.14+)? That's the behavior we're seeing here. We should make sure the spec version is the minimum needed to execute the model (in this case probably 1 or 2?).

@amiraeitan In the meantime, you can work around this bug by setting include_non_maximum_suppression to False. See https://apple.github.io/turicreate/docs/api/generated/turicreate.object_detector.ObjectDetector.export_coreml.html#turicreate.object_detector.ObjectDetector.export_coreml

@znation I'm a bit uncertain about this now. Linux doesn't have a runtime support for the Core ML model, but it can still export the file itself. Shouldn't this also be true for macOS 10.13 then?

@gustavla I think the behavior we're seeing is due to the logic in coremltools, which seems intended but may not be the logic we want going forward:

  • If on macOS, attempt to load, validate, and compile the model (so that the predict function will be available).
  • If on Linux, don't do any of that, and of course there is no predict function.

For this, I opened https://github.com/apple/coremltools/issues/198 to track in coremltools; when that's resolved, we can fix this issue by taking a dependency on the coremltools version that has the fix.

Thanks guys! I've downgraded to the 4.0 version for now and the export was working fine.

This should be fixed by #778 and apple/coremltools#207

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnyquest7 picture johnyquest7  路  6Comments

sejersbol picture sejersbol  路  3Comments

tagy picture tagy  路  5Comments

alelordelo picture alelordelo  路  5Comments

hoytak picture hoytak  路  3Comments