-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
apiissues related to all other APIs: C, C++, Python, etc.issues related to all other APIs: C, C++, Python, etc.staleissues that have not been addressed in a while; categorized by a botissues that have not been addressed in a while; categorized by a bot
Description
Describe the issue
When converting a scikit-learn GaussianProcessClassifier to ONNX format and attempting to run inference with ONNX Runtime, the following error occurs:
Any help or feedback with the following issue will be much appreciated!
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Fatal error: com.microsoft:Solve(-1) is not a registered function/op
Environment
- Python version: 3.10
- scikit-learn version: 1.5.0
- skl2onnx version: 1.17.0
- onnxruntime version: 1.19.2
- OS: macOS 15.3.2
To reproduce
Steps to reproduce
import numpy as np
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import RBF
from skl2onnx import convert_sklearn
from skl2onnx.common.data_types import FloatTensorType
import onnxruntime as rt
# Generate a simple binary classification dataset with 20 points
np.random.seed(42)
X = np.random.randn(20, 2) # 20 points with 2 features
y = (X[:, 0] + X[:, 1] > 0).astype(int) # Simple decision boundary: x + y > 0
# Train a Gaussian Process Classifier
kernel = 1.0 * RBF(length_scale=1.0)
gpc = GaussianProcessClassifier(kernel=kernel, random_state=42)
gpc.fit(X, y)
# Convert the model to ONNX
initial_type = [("float_input", FloatTensorType([None, 2]))]
onx = convert_sklearn(gpc, initial_types=initial_type)
# Create a single data point for prediction
test_point = np.array([[0.5, 0.5]], dtype=np.float32)
# Print the sklearn prediction for comparison
sklearn_pred = gpc.predict(test_point)
sklearn_proba = gpc.predict_proba(test_point)
print(f"Sklearn prediction: {sklearn_pred}")
print(f"Sklearn probabilities: {sklearn_proba}")
# Make prediction with ONNX runtime
# Create an ONNX runtime session
sess = rt.InferenceSession(onx.SerializeToString())
input_name = sess.get_inputs()[0].name
pred_onx = sess.run(None, {input_name: test_point})
print(f"ONNX prediction: {pred_onx[0]}")
print(f"ONNX probabilities: {pred_onx[1]}")Urgency
No response
Platform
Mac
OS Version
15.3.2
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.19.2
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
Metadata
Metadata
Assignees
Labels
apiissues related to all other APIs: C, C++, Python, etc.issues related to all other APIs: C, C++, Python, etc.staleissues that have not been addressed in a while; categorized by a botissues that have not been addressed in a while; categorized by a bot