NeMo icon indicating copy to clipboard operation
NeMo copied to clipboard

How to export SLUIntentSlotBPEModel to ONNX

Open Khanh-lt269 opened this issue 1 year ago • 1 comments

Hello guys, I'm dealing with this issue for days but still unable to find the key. I have followed export steps as this link. It works for ASR models, but when I need to export SLUIntentSlotBPEModel model, it shows this following error. Have anyone tried to export this model?

slu_model.export('/home4/khanhlt/nemo_api/onnx/nemo_slu.onnx')
{
	"name": "AttributeError",
	"message": "'SLUIntentSlotBPEModel' object has no attribute 'output_names'",
	"stack": "---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 slu_model.export('/home4/khanhlt/nemo_api/onnx/nemo_slu.onnx')

File //home4/khanhlt/slu/Nemo_SLU_2/NeMo/nemo/core/classes/exportable.py:114, in Exportable.export(self, output, input_example, verbose, do_constant_folding, onnx_opset_version, check_trace, dynamic_axes, check_tolerance, export_modules_as_functions, keep_initializers_as_inputs)
    112 model = self.get_export_subnet(subnet_name)
    113 out_name = augment_filename(output, subnet_name)
--> 114 out, descr, out_example = model._export(
    115     out_name,
    116     input_example=input_example,
    117     verbose=verbose,
    118     do_constant_folding=do_constant_folding,
    119     onnx_opset_version=onnx_opset_version,
    120     check_trace=check_trace,
    121     dynamic_axes=dynamic_axes,
    122     check_tolerance=check_tolerance,
    123     export_modules_as_functions=export_modules_as_functions,
    124     keep_initializers_as_inputs=keep_initializers_as_inputs,
    125 )
    126 # Propagate input example (default scenario, may need to be overriden)
    127 if input_example is not None:

File //home4/khanhlt/slu/Nemo_SLU_2/NeMo/nemo/core/classes/exportable.py:191, in Exportable._export(self, output, input_example, verbose, do_constant_folding, onnx_opset_version, check_trace, dynamic_axes, check_tolerance, export_modules_as_functions, keep_initializers_as_inputs)
    189 input_list, input_dict = parse_input_example(input_example)
    190 input_names = self.input_names
--> 191 output_names = self.output_names
    192 output_example = tuple(self.forward(*input_list, **input_dict))
    194 if check_trace:

File ~/miniconda3/envs/nemo/lib/python3.10/site-packages/torch/nn/modules/module.py:1709, in Module.__getattr__(self, name)
   1707     if name in modules:
   1708         return modules[name]
-> 1709 raise AttributeError(f\"'{type(self).__name__}' object has no attribute '{name}'\")

AttributeError: 'SLUIntentSlotBPEModel' object has no attribute 'output_names'"
}

Khanh-lt269 avatar Jun 20 '24 20:06 Khanh-lt269

We don't support export of the SLU model

titu1994 avatar Jun 20 '24 21:06 titu1994

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 03 '24 01:08 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Aug 10 '24 01:08 github-actions[bot]