Created
June 20, 2023 07:25
-
-
Save albertz/a3d9cd16d0959bf7c964d4647f18508d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unhandled exception <class 'RuntimeError'> in thread <_MainThread(MainThread, started 140574602995520)>, proc 71253. | |
Thread current, main, <_MainThread(MainThread, started 140574602995520)>: | |
(Excluded thread.) | |
That were all threads. | |
EXCEPTION | |
Traceback (most recent call last): | |
File "/home/nbeneitez/Documentos/work/repos/returnn_pytorch/tools/torch_export_to_onnx.py", line 209, in <module> | |
line: main() | |
locals: | |
main = <local> <function main at 0x7fd950a55a20> | |
File "/home/nbeneitez/Documentos/work/repos/returnn_pytorch/tools/torch_export_to_onnx.py", line 197, in main | |
line: export_func( | |
pt_model_fwd, | |
(extern_data_raw, {}), | |
f=args.out_onnx_filename, | |
verbose=True, | |
input_names=list(extern_data_raw.keys()), | |
output_names=model_outputs_raw_keys, | |
dynamic_axes=dynamic_axes, | |
) | |
locals: | |
export_func = <local> <function export at 0x7fd95339fb50> | |
pt_model_fwd = <local> ForwardModulePT( | |
(model): Model( | |
(layers): Sequential( | |
(0): Conv1d(9, 50, kernel_size=(5,), stride=(1,), padding=(2,)) | |
(1): ReLU() | |
(2): Conv1d(50, 100, kernel_size=(5,), stride=(1,), padding=(2,)) | |
(3): ReLU() | |
(4): Conv1d(100, 2, kernel_size=(5,), stride=(1,), p... | |
extern_data_raw = <local> {'data': tensor([[[-0.2342, -0.2341, 1.5792, 0.7674, -0.4695, 0.5426, -0.4634, | |
-0.4657, 0.2420], | |
[-1.9133, -1.7249, -0.5623, -1.0128, 0.3142, -0.9080, -1.4123, | |
1.4656, -0.2258], | |
[ 0.0675, -1.4247, -0.5444, 0.1109, -1.1510, 0.3757, -0.6006, | |
-..., len = 6 | |
f = <not found> | |
args = <local> Namespace(config='demos/demo-torch.config', checkpoint='/tmp/nbeneitez/returnn/demos/demo-torch/model.005.pt', out_onnx_filename='/tmp/nbeneitez/returnn/demos/demo-torch/model.005.onnx', verbosity=4, device='cpu') | |
args.out_onnx_filename = <local> '/tmp/nbeneitez/returnn/demos/demo-torch/model.005.onnx', len = 54 | |
verbose = <not found> | |
input_names = <not found> | |
list = <builtin> <class 'list'> | |
extern_data_raw.keys = <local> <built-in method keys of dict object at 0x7fd9522d12c0> | |
output_names = <not found> | |
model_outputs_raw_keys = <local> ['output', 'output:size0', 'output:size1'], _[0]: {len = 6} | |
dynamic_axes = <local> {'data': {0: 'global batch', 1: 'time:var-unk:data'}, 'data:size0': {}, 'data:size1': {0: 'global batch'}, 'classes': {0: 'global batch', 1: 'time:var-unk:classes'}, 'classes:size0': {}, 'classes:size1': {0: 'global batch'}, 'output': {0: 'global batch', 1: 'time:var-unk:output'}, 'output:size0':..., len = 9 | |
File "/home/nbeneitez/.venv/returnn_pytorch/lib/python3.10/site-packages/torch/onnx/utils.py", line 506, in export | |
line: _export( | |
model, | |
args, | |
f, | |
export_params, | |
verbose, | |
training, | |
input_names, | |
output_names, | |
operator_export_type=operator_export_type, | |
opset_version=opset_version, | |
do_constant_folding=do_constant_folding, | |
dynamic_axes=dynamic_axes, | |
keep_initializers_as_inputs=keep_initializers_as_inputs, | |
custom_opsets=custom_opsets, | |
export_modules_as_functions=export_modules_as_functions, | |
) | |
locals: | |
_export = <global> <function _export at 0x7fd9533a0a60> | |
model = <local> ForwardModulePT( | |
(model): Model( | |
(layers): Sequential( | |
(0): Conv1d(9, 50, kernel_size=(5,), stride=(1,), padding=(2,)) | |
(1): ReLU() | |
(2): Conv1d(50, 100, kernel_size=(5,), stride=(1,), padding=(2,)) | |
(3): ReLU() | |
(4): Conv1d(100, 2, kernel_size=(5,), stride=(1,), p... | |
args = <local> ({'data': tensor([[[-0.2342, -0.2341, 1.5792, 0.7674, -0.4695, 0.5426, -0.4634, | |
-0.4657, 0.2420], | |
[-1.9133, -1.7249, -0.5623, -1.0128, 0.3142, -0.9080, -1.4123, | |
1.4656, -0.2258], | |
[ 0.0675, -1.4247, -0.5444, 0.1109, -1.1510, 0.3757, -0.6006, | |
..., _[0]: {len = 6} | |
f = <local> '/tmp/nbeneitez/returnn/demos/demo-torch/model.005.onnx', len = 54 | |
export_params = <local> True | |
verbose = <local> True | |
training = <local> <TrainingMode.EVAL: 0> | |
input_names = <local> ['data', 'data:size0', 'data:size1', 'classes', 'classes:size0', 'classes:size1'], len = 6 | |
output_names = <local> ['output', 'output:size0', 'output:size1'], _[0]: {len = 6} | |
operator_export_type = <local> <OperatorExportTypes.ONNX: 0> | |
opset_version = <local> None | |
do_constant_folding = <local> True | |
dynamic_axes = <local> {'data': {0: 'global batch', 1: 'time:var-unk:data'}, 'data:size0': {}, 'data:size1': {0: 'global batch'}, 'classes': {0: 'global batch', 1: 'time:var-unk:classes'}, 'classes:size0': {}, 'classes:size1': {0: 'global batch'}, 'output': {0: 'global batch', 1: 'time:var-unk:output'}, 'output:size0':..., len = 9 | |
keep_initializers_as_inputs = <local> None | |
custom_opsets = <local> None | |
export_modules_as_functions = <local> False | |
File "/home/nbeneitez/.venv/returnn_pytorch/lib/python3.10/site-packages/torch/onnx/utils.py", line 1548, in _export | |
line: graph, params_dict, torch_out = _model_to_graph( | |
model, | |
args, | |
verbose, | |
input_names, | |
output_names, | |
operator_export_type, | |
val_do_constant_folding, | |
fixed_batch_size=fixed_batch_size, | |
training=training, | |
dynamic_axes=dynamic_axes, | |
) | |
locals: | |
graph = <not found> | |
params_dict = <not found> | |
torch_out = <not found> | |
_model_to_graph = <global> <function _model_to_graph at 0x7fd9533a0700> | |
model = <local> ForwardModulePT( | |
(model): Model( | |
(layers): Sequential( | |
(0): Conv1d(9, 50, kernel_size=(5,), stride=(1,), padding=(2,)) | |
(1): ReLU() | |
(2): Conv1d(50, 100, kernel_size=(5,), stride=(1,), padding=(2,)) | |
(3): ReLU() | |
(4): Conv1d(100, 2, kernel_size=(5,), stride=(1,), p... | |
args = <local> ({'data': tensor([[[-0.2342, -0.2341, 1.5792, 0.7674, -0.4695, 0.5426, -0.4634, | |
-0.4657, 0.2420], | |
[-1.9133, -1.7249, -0.5623, -1.0128, 0.3142, -0.9080, -1.4123, | |
1.4656, -0.2258], | |
[ 0.0675, -1.4247, -0.5444, 0.1109, -1.1510, 0.3757, -0.6006, | |
..., _[0]: {len = 6} | |
verbose = <local> True | |
input_names = <local> ['data', 'data:size0', 'data:size1', 'classes', 'classes:size0', 'classes:size1'], len = 6 | |
output_names = <local> ['output', 'output:size0', 'output:size1'], _[0]: {len = 6} | |
operator_export_type = <local> <OperatorExportTypes.ONNX: 0> | |
val_do_constant_folding = <local> True | |
fixed_batch_size = <local> False | |
training = <local> <TrainingMode.EVAL: 0> | |
dynamic_axes = <local> {'data': {0: 'global batch', 1: 'time:var-unk:data'}, 'data:size0': {}, 'data:size1': {0: 'global batch'}, 'classes': {0: 'global batch', 1: 'time:var-unk:classes'}, 'classes:size0': {}, 'classes:size1': {0: 'global batch'}, 'output': {0: 'global batch', 1: 'time:var-unk:output'}, 'output:size0':..., len = 9 | |
File "/home/nbeneitez/.venv/returnn_pytorch/lib/python3.10/site-packages/torch/onnx/utils.py", line 1169, in _model_to_graph | |
line: _set_input_and_output_names(graph, input_names, output_names) | |
locals: | |
_set_input_and_output_names = <global> <function _set_input_and_output_names at 0x7fd9533a0b80> | |
graph = <local> graph(%data : Float(*, *, 9, strides=[144, 9, 1], requires_grad=0, device=cpu), | |
%data:size0 : Int(requires_grad=0, device=cpu), | |
%data:size1 : Int(*, strides=[1], requires_grad=0, device=cpu), | |
%classes : Int(*, *, strides=[7, 1], requires_grad=0, device=cpu), | |
%classes:size0... | |
input_names = <local> ['data', 'data:size0', 'data:size1', 'classes', 'classes:size0', 'classes:size1'], len = 6 | |
output_names = <local> ['output', 'output:size0', 'output:size1'], _[0]: {len = 6} | |
File "/home/nbeneitez/.venv/returnn_pytorch/lib/python3.10/site-packages/torch/onnx/utils.py", line 1690, in _set_input_and_output_names | |
line: set_names(list(graph.outputs()), output_names, "output") | |
locals: | |
set_names = <local> <function _set_input_and_output_names.<locals>.set_names at 0x7fd9508779a0> | |
list = <builtin> <class 'list'> | |
graph = <local> graph(%data : Float(*, *, 9, strides=[144, 9, 1], requires_grad=0, device=cpu), | |
%data:size0 : Int(requires_grad=0, device=cpu), | |
%data:size1 : Int(*, strides=[1], requires_grad=0, device=cpu), | |
%classes : Int(*, *, strides=[7, 1], requires_grad=0, device=cpu), | |
%classes:size0... | |
graph.outputs = <local> <bound method PyCapsule.outputs of graph(%data : Float(*, *, 9, strides=[144, 9, 1], requires_grad=0, device=cpu), | |
%data:size0 : Int(requires_grad=0, device=cpu), | |
%data:size1 : Int(*, strides=[1], requires_grad=0, device=cpu), | |
%classes : Int(*, *, strides=[7, 1], requires_grad=0... | |
output_names = <local> ['output', 'output:size0', 'output:size1'], _[0]: {len = 6} | |
File "/home/nbeneitez/.venv/returnn_pytorch/lib/python3.10/site-packages/torch/onnx/utils.py", line 1667, in _set_input_and_output_names.<locals>.set_names | |
line: raise RuntimeError( | |
"number of %s names provided (%d) exceeded number of %ss (%d)" | |
% (descriptor, len(name_list), descriptor, len(node_list)) | |
) | |
locals: | |
RuntimeError = <builtin> <class 'RuntimeError'> | |
descriptor = <local> 'output', len = 6 | |
len = <builtin> <built-in function len> | |
name_list = <local> ['output', 'output:size0', 'output:size1'], _[0]: {len = 6} | |
node_list = <local> [raw_tensor defined in (%raw_tensor : Float(*, *, 2, strides=[32, 1, 16], requires_grad=1, device=cpu) = onnx::Transpose[perm=[0, 2, 1]](%17), scope: __returnn_config__.Model::model # demos/demo-torch.config:53:0 | |
), 19 defined in (%19 : Int(requires_grad=0, device=cpu) = onnx::Identity(%classes:s... | |
RuntimeError: number of output names provided (3) exceeded number of outputs (2) | |
Process finished with exit code 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rwth-i6/returnn#1333 (comment)