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

can`t convert model in visual studio #19

Open
dorademon opened this issue May 28, 2018 · 4 comments
Open

can`t convert model in visual studio #19

dorademon opened this issue May 28, 2018 · 4 comments

Comments

@dorademon
Copy link

dorademon commented May 28, 2018

HI, I want to convert a scikit-learn model to onnx,but I dont now how to set up the input_featrues parameters. thanks :)

my model featrues :
Sepal Length float 1
Sepal Width float 1
Petal Length float 1
Petal Width float 1

Here are the error logs :

System.Exception: D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\sklearn\base.py:311: UserWarning: Trying to unpickle estimator LogisticRegression from version 0.18.1 when using version 0.19.1. This might lead to breaking code or invalid results. Use at your own risk.
UserWarning)
Traceback (most recent call last):
File "C:\USERS\H00316469\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\15.0_04A81442\EXTENSIONS\Y2LMQEZR.VBA\RuntimeSDK\model\model_converter_cli.py", line 203, in convert_sklearn_to_onnx
model_onnx = convert_sklearn(model_sklearn, extra_args.get(paramname_graph_name), input_features)
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\winmltools\convert\main.py", line 20, in convert_sklearn
return _convert_sklearn(model, name, input_features)
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\sklearn\convert.py", line 109, in convert
nodes += _convert_sklearn_node(context, model, node_inputs)
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\sklearn\convert.py", line 159, in _convert_sklearn_node
return _do_convert(context, converter, node, inputs)
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\sklearn\convert.py", line 148, in _do_convert
node = converter.convert(context, sk_node, inputs)
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\sklearn\GLMClassifierConverter.py", line 63, in convert
class_labels = utils.cast_list(int, classes)
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\common\utils.py", line 144, in cast_list
return [type(item) for item in items]
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\common\utils.py", line 144, in
return [type(item) for item in items]
ValueError: invalid literal for int() with base 10: 'Iris-setosa'

Best regards

@dorademon
Copy link
Author

Add this feature Species string 1 (this is a label, can it be used as a feature ?)

Now my model features:
Sepal Length float 1
Sepal Width float 1
Petal Length float 1
Petal Width float 1
Species string 1

Error log:
System.Exception: D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\sklearn\base.py:311: UserWarning: Trying to unpickle estimator LogisticRegression from version 0.18.1 when using version 0.19.1. This might lead to breaking code or invalid results. Use at your own risk.
UserWarning)
Traceback (most recent call last):
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\sklearn\convert.py", line 97, in convert
nodes.extend(_combine_inputs(context, model_inputs))
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\sklearn\convert.py", line 176, in _combine_inputs
"These types are not supported when specifying multiple inputs {0}".format(onnx_unsupported_types))
RuntimeError: Unsupported type specified.These types are not supported when specifying multiple inputs [8]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\USERS\H00316469\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\15.0_04A81442\EXTENSIONS\Y2LMQEZR.VBA\RuntimeSDK\model\model_converter_cli.py", line 203, in convert_sklearn_to_onnx
model_onnx = convert_sklearn(model_sklearn, extra_args.get(paramname_graph_name), input_features)
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\winmltools\convert\main.py", line 20, in convert_sklearn
return _convert_sklearn(model, name, input_features)
File "D:\sofatware\microsoft Visual Studio\shared\Python36_64\lib\site-packages\onnxmltools\convert\sklearn\convert.py", line 103, in convert
raise ValueError('Invalid input_features argument.')
ValueError: Invalid input_features argument.

@tocean
Copy link

tocean commented May 28, 2018

Could you share you model file?

@dorademon
Copy link
Author

@tocean
Thanks for your attention, I can't share my model file because of information security.
the main question is
how can I set the Extra arguments (Graph name/Input features including name,type and shape)? docs of tools for AI doesn't tell this.

@tocean
Copy link

tocean commented May 29, 2018

It depends on the input of your model. For this case, if the input feature is a float array with shape [4], I think the following should work.
image
Graph name is only an attribute of the ONNX graph. So input a meaningful name you like. If it is empty, a guid will filled automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants