-
Notifications
You must be signed in to change notification settings - Fork 273
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
if i have saved a pytorch_based model, i want to run inference on cpu, how to change the codes? #739
Comments
Hi! Just change |
I think we have to update the readme. https://github.com/microsoft/hummingbird#examples # Use Hummingbird to convert the model to PyTorch
model = convert(skl_model, 'pytorch')
# Run predictions on CPU
model.predict(X)
# Run predictions on GPU
model.to('cuda')
model.predict(X) |
Was this an API change in a newer version of torch? Because the README example definitely works, or used to! |
I was not able to reproduce this issue with the latest ( @Bobby-youngking can you please post which versions you are using and a bit more info? you shouldn't have to reassign the model |
Closing due to inactivity and we cannot repro, please reopen if you still have problems with this. |
from sklearn import datasets
from sklearn.ensemble import RandomForestClassifier
from hummingbird.ml import convert, load
iris = datasets.load_iris()
X, y = iris.data, iris.target
rfmodel = load('hb_model')
rfmodel.to('cpu')
print(rfmodel.predict(X))
i tried this way, but the result showed that i was running on gpu
The text was updated successfully, but these errors were encountered: