Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model prediction does not work in Python 3 #37

Closed
srikris opened this issue Oct 6, 2017 · 3 comments
Closed

Model prediction does not work in Python 3 #37

srikris opened this issue Oct 6, 2017 · 3 comments
Labels
bug Unexpected behaviour that should be corrected (type)

Comments

@srikris
Copy link
Contributor

srikris commented Oct 6, 2017

With Python 3, the prediction code path using PyBind11 doesn't quite work. This is required to have full functionality with Python 3

Here is a simle repro step (this works in Python 2.7)
``
from sklearn import datasets
from sklearn.ensemble import RandomForestClassifier
import coremltools
import numpy

Train a scikit-learn model for Iris data

iris = datasets.load_iris()
clf = RandomForestClassifier()
clf.fit(iris.data, iris.target_names[iris.target])

Convert the model

model = coremltools.converters.sklearn.convert(clf)

Make predictions

model.predict({'input': np.zeros(4)})
``

@srikris srikris changed the title Model prediction does not work in Python 3 (works with Python 2.7) Model prediction does not work in Python 3 Oct 6, 2017
@srikris srikris mentioned this issue Oct 6, 2017
@luke14free
Copy link

Not even conversion works. Some files make use of the xrange function

@srikris srikris added the bug Unexpected behaviour that should be corrected (type) label Oct 8, 2017
@TobyRoseman
Copy link
Collaborator

@luke14free - I currently have a pull request. Once that is merged then conversion should work.

@TobyRoseman
Copy link
Collaborator

@luke14free - the pull request has been merged. Please try conversion now in Python 3 and let us know if you run into any issues.

@srikris srikris closed this as completed Jan 26, 2018
Birch-san pushed a commit to Birch-san/coremltools that referenced this issue Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behaviour that should be corrected (type)
Projects
None yet
Development

No branches or pull requests

3 participants