from transformers.convert_graph_to_onnx import convert
convert(framework=‘pt’,pipeline_name =‘question-answering’, model=‘roberta-base-squad2’,output=my_outputpath,opset=11)
ONNX opset version set to: 11
Loading pipeline (model: roberta-base-squad2, tokenizer: roberta-base-squad2)
Using framework PyTorch: 1.10.0+cu111
Found input input_ids with shape: {0: ‘batch’, 1: ‘sequence’}
Found input attention_mask with shape: {0: ‘batch’, 1: ‘sequence’}
Found output output_0 with shape: {0: ‘batch’, 1: ‘sequence’}
Found output output_1 with shape: {0: ‘batch’, 1: ‘sequence’}
Ensuring inputs are in correct order
token_type_ids is not present in the generated input list.
Generated inputs order: [‘input_ids’, ‘attention_mask’]
/usr/local/lib/python3.7/dist-packages/torch/onnx/utils.py:90: UserWarning: ‘enable_onnx_checker’ is deprecated and ignored. It will be removed in the next PyTorch release. To proceed despite ONNX checker failures, catch torch.onnx.ONNXCheckerError.
warnings.warn("‘enable_onnx_checker’ is deprecated and ignored. It will be removed in "
/usr/local/lib/python3.7/dist-packages/torch/onnx/utils.py:103: UserWarning: use_external_data_format' is deprecated and ignored. Will be removed in next PyTorch release. The code will work as it is False if models are not larger than 2GB, Otherwise set to False because of size limits imposed by Protocol Buffers.   warnings.warn("use_external_data_format’ is deprecated and ignored. Will be removed in next "
Successfully converted.
however when I tried to run
sessions = InferenceSession(‘onnx/roberta-base-squad2.onnx’,options)
sessions.run([‘output_0’,‘output_1’],[context,ques])
186             output_names = [output.name for output in self._outputs_meta]
187         try:

 → 188             return self._sess.run(output_names, input_feed, run_options)
189         except C.EPFail as err:
190             if self._enable_fallback:
TypeError: run(): incompatible function arguments. The following argument types are supported:
1. (self: onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession, arg0: List[str], arg1: Dict[str, object], arg2: onnxruntime.capi.onnxruntime_pybind11_state.RunOptions) → List[object]
Invoked with: <onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession object at 0x7f2e80bc4130>, [‘output_0’, ‘output_1’], {‘input_ids’: tensor([[   0, 2264,   16,    5,  645,  346,  116,    2]]), ‘attention_mask’: tensor([[1, 1, 1, 1, 1, 1, 1, 1]])}, None