Closed tasiddiq94 closed 3 years ago
I am following the tutorial in the following link to train a Kewyword spotter with Pytorch using ELL: https://microsoft.github.io/ELL/tutorials/Training-audio-keyword-spotter-with-pytorch/
After training my model and saving it to the following onnx file: GRU128KeywordSpotter.onnx, I need to import it from ONNX format into the ELL format using the following command:
[Windows] python %ELL_ROOT%\tools\importers\onnx\onnx_import.py GRU128KeywordSpotter.onnx
When I run the above command, I get the following error:
MainThread [2020-06-10 05:28:32,891] Pre-processing... MainThread [2020-06-10 05:28:32,891] loading the ONNX model from: GRU128KeywordSpotter.onnx MainThread [2020-06-10 05:28:33,291] Loaded ONNX model in 0.400 seconds. MainThread [2020-06-10 05:28:33,292] ONNX IR_version 6 MainThread [2020-06-10 05:28:33,293] ONNX Graph producer: pytorch version 1.5 MainThread [2020-06-10 05:28:33,294] ONNX Graph total len: 1 MainThread [2020-06-10 05:28:33,788] Input input.1 Inputs [] [] Outputs: ['input.1'] [((1, 1, 80), 'channel_row_column')] Attributes: {} MainThread [2020-06-10 05:28:33,788] Shape Shape_0 Inputs ['input.1'] [((1, 1, 80), 'channel_row_column')] Outputs: ['11'] [((1, 1, 80), 'channel_row_column')] Attributes: {} MainThread [2020-06-10 05:28:33,788] Constant Constant_1 Inputs [] [] Outputs: ['12'] [((1,), 'channel')] Attributes: {'tensor': '...'} MainThread [2020-06-10 05:28:33,788] Constant 11 Inputs [] [] Outputs: ['11'] [((3,), 'channel')] Attributes: {'tensor': '...'} MainThread [2020-06-10 05:28:33,788] Gather Gather_2 Inputs ['11', '12'] [((1, 1, 80), 'channel_row_column'), ((1,), 'channel')] Outputs: ['13'] [((1, 80), 'row_column')] Attributes: {'axis': 0} MainThread [2020-06-10 05:28:33,788] Unsqueeze Unsqueeze_3 Inputs ['13'] [((1, 80), 'row_column')] Outputs: ['17'] [((1, 1, 80), 'channel_row_column')] Attributes: {'axes': [0]} Traceback (most recent call last): File "C:\Users\taima\ELL\tools\importers\onnx\onnx_import.py", line 95, in main() File "C:\Users\taima\ELL\tools\importers\onnx\onnx_import.py", line 91, in main convert(args.input, args.output_directory, args.zip_ell_model, args.step_interval, args.lag_threshold) File "C:\Users\taima\ELL\tools\importers\onnx\onnx_import.py", line 42, in convert lag_threshold_msec=lag_threshold) File "C:\Users\taima\ELL\tools\importers\onnx\onnx_to_ell.py", line 32, in convert_onnx_to_ell importer_model = converter.load_model(path) File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 2004, in load_model return self.set_graph(graph) File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 2026, in set_graph node = self.get_converter(onnx_node).convert(onnx_node) File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 1321, in convert node = super().convert(node) File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 118, in convert node.output_shapes = self.get_output_shapes() File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 1351, in get_output_shapes n = self.get_node(id) File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 194, in get_node return self.converter.get_node(id) File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 2075, in get_node return self.model.nodes[id] KeyError: '83'
Can anybody explain what the problem is and help resolve the issue?
This seems to be a duplicate of issue #252 ?
I am following the tutorial in the following link to train a Kewyword spotter with Pytorch using ELL: https://microsoft.github.io/ELL/tutorials/Training-audio-keyword-spotter-with-pytorch/
After training my model and saving it to the following onnx file: GRU128KeywordSpotter.onnx, I need to import it from ONNX format into the ELL format using the following command:
[Windows] python %ELL_ROOT%\tools\importers\onnx\onnx_import.py GRU128KeywordSpotter.onnx
When I run the above command, I get the following error:
MainThread [2020-06-10 05:28:32,891] Pre-processing... MainThread [2020-06-10 05:28:32,891] loading the ONNX model from: GRU128KeywordSpotter.onnx MainThread [2020-06-10 05:28:33,291] Loaded ONNX model in 0.400 seconds. MainThread [2020-06-10 05:28:33,292] ONNX IR_version 6 MainThread [2020-06-10 05:28:33,293] ONNX Graph producer: pytorch version 1.5 MainThread [2020-06-10 05:28:33,294] ONNX Graph total len: 1 MainThread [2020-06-10 05:28:33,788] Input input.1 Inputs [] [] Outputs: ['input.1'] [((1, 1, 80), 'channel_row_column')] Attributes: {} MainThread [2020-06-10 05:28:33,788] Shape Shape_0 Inputs ['input.1'] [((1, 1, 80), 'channel_row_column')] Outputs: ['11'] [((1, 1, 80), 'channel_row_column')] Attributes: {} MainThread [2020-06-10 05:28:33,788] Constant Constant_1 Inputs [] [] Outputs: ['12'] [((1,), 'channel')] Attributes: {'tensor': '...'} MainThread [2020-06-10 05:28:33,788] Constant 11 Inputs [] [] Outputs: ['11'] [((3,), 'channel')] Attributes: {'tensor': '...'} MainThread [2020-06-10 05:28:33,788] Gather Gather_2 Inputs ['11', '12'] [((1, 1, 80), 'channel_row_column'), ((1,), 'channel')] Outputs: ['13'] [((1, 80), 'row_column')] Attributes: {'axis': 0} MainThread [2020-06-10 05:28:33,788] Unsqueeze Unsqueeze_3 Inputs ['13'] [((1, 80), 'row_column')] Outputs: ['17'] [((1, 1, 80), 'channel_row_column')] Attributes: {'axes': [0]} Traceback (most recent call last): File "C:\Users\taima\ELL\tools\importers\onnx\onnx_import.py", line 95, in
main()
File "C:\Users\taima\ELL\tools\importers\onnx\onnx_import.py", line 91, in main
convert(args.input, args.output_directory, args.zip_ell_model, args.step_interval, args.lag_threshold)
File "C:\Users\taima\ELL\tools\importers\onnx\onnx_import.py", line 42, in convert
lag_threshold_msec=lag_threshold)
File "C:\Users\taima\ELL\tools\importers\onnx\onnx_to_ell.py", line 32, in convert_onnx_to_ell
importer_model = converter.load_model(path)
File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 2004, in load_model
return self.set_graph(graph)
File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 2026, in set_graph
node = self.get_converter(onnx_node).convert(onnx_node)
File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 1321, in convert
node = super().convert(node)
File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 118, in convert
node.output_shapes = self.get_output_shapes()
File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 1351, in get_output_shapes
n = self.get_node(id)
File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 194, in get_node
return self.converter.get_node(id)
File "C:\Users\taima\ELL\tools\importers\onnx\lib\onnx_converters.py", line 2075, in get_node
return self.model.nodes[id]
KeyError: '83'
Can anybody explain what the problem is and help resolve the issue?