coremltools icon indicating copy to clipboard operation
coremltools copied to clipboard

Unable to call predict

Open adilnaut opened this issue 7 years ago • 8 comments

Mac OS 10.14.5 Python 3.5.0 coremltools 3.0b2 tensorflow 1.14.0

Traceback (most recent call last):
  File "infer.py", line 12, in <module>
    predictions = model.predict({'inputs': [np.asarray(seq, dtype=np.int32)], 'input_lengths': np.asarray([len(seq)], dtype=np.int32)})
  File "/Users/adilettuleuov/.pyenv/versions/3.5.0/lib/python3.5/site-packages/coremltools/models/model.py", line 338, in predict
    raise Exception('Unable to load CoreML.framework. Cannot make predictions.')
Exception: Unable to load CoreML.framework. Cannot make predictions.

Mac OS 10.14.5 Python 3.7.3 coremltools 3.0b2 tensorflow 1.14.0

Segmentation fault: 11

Debugging shows that segmentation fault was caused by calling this import

from coremltools.libcoremlpython import _MLModelProxy

adilnaut avatar Jul 16 '19 17:07 adilnaut

This is issue of missing library from package. @adilnaut could you please try with coremltools beta 3? pip install coremltools==3.0b3

bhushan23 avatar Jul 16 '19 17:07 bhushan23

This is likely a dup of #372

TobyRoseman avatar Jul 16 '19 19:07 TobyRoseman

@bhushan23 I tried with coremltools beta 3, and it's clear what is the issue now: It seems like I should install Xcode 11. My model was converted using the second beta.

 RuntimeWarning: You will not be able to run predict() on this Core ML model. Underlying exception message was: Error compiling model: "Error reading protobuf spec. validator error: The .mlmodel supplied is of version 4, intended for a newer version of Xcode. This version of Xcode supports model version 3 or earlier.".
  RuntimeWarning)
Traceback (most recent call last):
  File "infer.py", line 12, in <module>
    predictions = model.predict({'inputs': [np.asarray(seq, dtype=np.int32)], 'input_lengths': np.asarray([len(seq)], dtype=np.int32)})
  File "/Users/adilettuleuov/tacotron/.env/lib/python3.7/site-packages/coremltools/models/model.py", line 354, in predict
    raise Exception('Unable to load CoreML.framework. Cannot make predictions.')
Exception: Unable to load CoreML.framework. Cannot make predictions.

adilnaut avatar Jul 17 '19 11:07 adilnaut

@adilnaut right. It should work with Xcode 11 Please do update

bhushan23 avatar Jul 17 '19 16:07 bhushan23

@bhushan23 We have Xcode 11 Beta (and even uninstalled XCode 10) but still hit this issue.

Is there a known workaround?

cc @lysandreJik

julien-c avatar Jul 19 '19 21:07 julien-c

Mac OS 10.15 is also required, as that is what contains the newer CoreML framework which is required to execute CoreML spec version 4 (coremltools uses the underlying CoreML framework to run models)

aseemw avatar Jul 19 '19 23:07 aseemw

Indeed, thanks @aseemw

julien-c avatar Jul 23 '19 00:07 julien-c

Indeed, thanks @aseemw Hi @julien-c @aseemw,

Which Mac OS version should be used? I used "19A536g", it still hit this issue "Segmentation fault: 11"

edis219 avatar Aug 28 '19 03:08 edis219