sklearn-onnx
sklearn-onnx copied to clipboard
ONNX session conversion taking long time if model has more estimators
Can I have some help on this please I have 2 pyod Isolation Forest algorithms, one with 100 estimators, another with 750 estimators attached both modelProto files in compressed text files IsolationForestestimators.zip
versions
Windows
python 3.10.13
onnx==1.13.1
onnxconverter-common==1.13.0
onnxmltools==1.11.2
onnxruntime==1.14.1
skl2onnx==1.14.0
tf2onnx==1.13.0
Code
import onnx
import onnxruntime
import time
testData = [[7.290587738061329e-05, 0.3673094582185491, 0.0535714285714286, 0.2941176470588235]]
start = time.time()
ONNXModel = { } # model from attached text file
content = ONNXModel.SerializeToString()
sess = onnxruntime.InferenceSession(content) # This part taking long time
input_name = sess.get_inputs()[0].name
label_name = sess.get_outputs()[0].name
pred_onnx = sess.run([label_name], {input_name: testData_for_model})[0]
pred_onnx
end = time.time()
print('Time : ',end - start,'Seconds') #in seconds
getting below times
The session conversion taking long time, is this anything to do with library
Using this for pyod model to onnx conversion https://github.com/onnx/sklearn-onnx/blob/main/docs/tutorial/plot_wext_pyod_forest.py any help much appreciate