CoreML Quickstart example produces errors

I have been asked to start using CoreML and convert our tensorflow ML model.

So I wanted to follow the quickstart example documentation to see how to do this.

Here are the steps I took :

- Installation steps :

	1. install Conda package installer
		- download Miniconda3 v3.9 package : https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-MacOSX-x86_64.pkg
		- run the package installation
		- create an environment shell : conda create --name coremltools-env
			- creates in <user>/opt/miniconda3/envs/coremltools-env
		- activate the environment : conda activate coremltools-env
		- install pip for this environment : conda install pip
	2. install CoreML tools in the conda environment
		- pip install coremltools==5.0b5 (note this is a beta version, could not find the previous stable version)
	3. install tensorflow within the conda environment
		- pip install tensorflow
	4. install h5py
		- pip install h5py

- run the python script to load (from a distance) the tensorflow model and convert it to CoreML

I then run the python scripts as described in the documentation (except the test), and I get this error message :

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: Model specification version field missing or corrupt.".
  _warnings.warn(

Note - I have included all the text of the message.

Is this a problem with CoreML tools v5.0 beta 5 ?

Should I try a previous version of CoreML tools, if so, where can I find the correct version numbers ?

  • Ah sorry, I forgot to add the script I mentioned, but, when trying to include it here, it ended up as a mess. I simply used the same python script commands as described in the aforementioned article.

  • So I searched further and found that, during the process of conversion, I could obtain the spec object spec = model.get_spec(). I then dumped this out to a file and saw specificationVersion: 6. So, is this a bug in the version 5.0b5 of CoreML tools ?

Add a Comment

Replies

Having the same problem. Did you end up solving it?

Add a Comment