You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use convert_sklearn to convert my model to ONNX for use. My notebook runs and I can use the converted model within the notebook to make predictions... but when I try to take my ONNX model and use it in its production environment I am getting a version error:
Unsupported model IR version: 10, max supported IR version: 9
I don't think I can do much about the max supported IR version 9 (I'll be 100% honest I'm also kind of unclear what's going on here as this is my very first attempt at making a model from scratch ever).. Is there something I need to do in my call to convert_sklearn?
Here's the relevant code:
clr=MultiOutputClassifier(
LogisticRegression(max_iter=500),
)
model=clr.fit(
cv_clean.transform(X_train_clean), # Uncomment to try and comment out below#tfidf_clean.transform(X_train_raw), y_train
)
y_pred=model.predict(
cv_clean.transform(X_test_clean), # Uncomment to try and comment out below#tfidf_clean.transform(X_test_raw)
)
smaller_classification_report(y_test.values.astype(int), y_pred)
initial_type= [('float_input', FloatTensorType([None, cv_clean.transform(X_train_clean).shape[1]]))]
onnx_model=convert_sklearn(model, initial_types=initial_type, options={type(clr.estimator): {'zipmap': False}})
onnx_model_path="build/Arvee/tags-classifier/onnx/model_quantized.onnx"withopen(onnx_model_path, "wb") asf:
f.write(onnx_model.SerializeToString())
print(f"ONNX model saved to {onnx_model_path}")
session=rt.InferenceSession(onnx_model_path)
# Prepare the test data for ONNX RuntimeX_test_onnx=cv_clean.transform(X_test_clean).toarray().astype(np.float32)
# Execute the model against the test datainput_name=session.get_inputs()[0].namelabel_name=session.get_outputs()[0].namey_pred_onnx=session.run([label_name], {input_name: X_test_onnx})[0]
# Print the classification reportsmaller_classification_report(y_test.values.astype(int), y_pred_onnx)
The text was updated successfully, but these errors were encountered:
I'm trying to use
convert_sklearn
to convert my model to ONNX for use. My notebook runs and I can use the converted model within the notebook to make predictions... but when I try to take my ONNX model and use it in its production environment I am getting a version error:Unsupported model IR version: 10, max supported IR version: 9
I don't think I can do much about the max supported IR version 9 (I'll be 100% honest I'm also kind of unclear what's going on here as this is my very first attempt at making a model from scratch ever).. Is there something I need to do in my call to
convert_sklearn
?Here's the relevant code:
The text was updated successfully, but these errors were encountered: