onnx / tutorials

Tutorials for creating and using ONNX models
Apache License 2.0
3.39k stars 629 forks source link

libcaffeconverter import error for caffe to onnx #215

Closed infinityp913 closed 4 years ago

infinityp913 commented 4 years ago

Describe the bug

I'm following the caffe to onnx tutorial at https://github.com/onnx/onnx-docker/blob/master/onnx-ecosystem/converter_scripts/caffe_coreml_onnx.ipynb and I encounter this error: ImportError: cannot import name 'libcaffeconverter' from 'coremltools'

On further investigation, I realized that there is no libcaffeconverter in the coremltools directory.

This issue is the same as apple/coremltools#773 however the solution there didn't work for me and another user. And that issue didn't seem to be getting any attention hence making a new issue here. System information

OS Platform and Distribution: Windows 10 x64
ONNX version: 1.7.0
Python version: 3.7.7
Protobuf version: 3.13.0
Visual Studio version (if applicable): 2017 version 15.9.28307.1234

Reproduction instructions

create a NEW environment and run "pip install coremltools==4.0b3"

run

in python interpreter run the code at https://github.com/onnx/onnx-docker/blob/master/onnx-ecosystem/converter_scripts/caffe_coreml_onnx.ipynb

OR

Run:

import coremltools coremltools.converters.caffe.convert(None)

Expected behavior

I expected the code to create and save a an onnx file based on the caffe file specified in the code

vinitra-zz commented 4 years ago

Hi @infinityp913. This looks like a versioning issue with coremltools. In Apple's latest release of the package, they broke some support of converter functionality. As referenced in the requirements.txt of the onnx-ecosystem docker image, where the converter notebook you linked is from, we recommend using coremltools==2.1.

You can install it from PyPi, with a simple pip install coremltools==2.1 and this should fix your error.

vinitra-zz commented 4 years ago

Please feel free to reopen this issue if you're still having trouble!

infinityp913 commented 4 years ago

@vinitra pip installing any coremltools version besides 4.* returns a "No matching distribution found". It seems that Apple has removed older versions of coremltools from PyPi.

Please reopen the issue

sid0913 commented 4 years ago

I'm having the same issue