Repository: huggingface/optimum

Issue:
`*with_loss` wrappers failed for transformers 4.19.0
# Problem
As new the new argument `num_choices` added in `transformers.onnx.config.generate_dummy_inputs`, the wrappers will fail to match correct arguments

### Error Message
------------
```
Traceback (most recent call last):
  File "test_onnxruntime_train.py", line 116, in test_ort_trainer
    ort_eval_metrics = trainer.evaluate(inference_with_ort=inference_with_ort)
  File "/workspace/optimum/onnxruntime/trainer.py", line 631, in evaluate
    output = eval_loop(
  File "/workspace/optimum/onnxruntime/trainer.py", line 767, in evaluation_loop_ort
    self._export(onnx_model_path, with_loss=with_loss)
  File "/workspace/optimum/onnxruntime/trainer.py", line 1230, in _export
    _ = export(preprocessor=self.tokenizer, model=model, config=onnx_config, opset=opset, output=model_path)
  File "/usr/local/lib/python3.8/dist-packages/transformers/onnx/convert.py", line 313, in export
    return export_pytorch(preprocessor, model, config, opset, output, tokenizer=tokenizer)
  File "/usr/local/lib/python3.8/dist-packages/transformers/onnx/convert.py", line 138, in export_pytorch
    model_inputs = config.generate_dummy_inputs(preprocessor, framework=TensorType.PYTORCH)
  File "/workspace/optimum/onnx/configuration.py", line 170, in generate_dummy_inputs
    dummy_inputs = super().generate_dummy_inputs(
  File "/usr/local/lib/python3.8/dist-packages/transformers/onnx/config.py", line 308, in generate_dummy_inputs
    token_to_add = preprocessor.num_special_tokens_to_add(is_pair)
  File "/usr/local/lib/python3.8/dist-packages/transformers/tokenization_utils_fast.py", line 289, in num_special_tokens_to_add
    return self._tokenizer.num_special_tokens_to_add(pair)
TypeError: Can't convert <TensorType.PYTORCH: 'pt'> to PyBool
```

# Solution
Add keys for arguments


Discussion:

Resolving patch:
diff --git a/optimum/onnx/configuration.py b/optimum/onnx/configuration.py
--- a/optimum/onnx/configuration.py
+++ b/optimum/onnx/configuration.py
@@ -168,15 +168,15 @@ def generate_dummy_inputs(
         """
         # Generate dummy labels
         dummy_inputs = super().generate_dummy_inputs(
-            preprocessor,
-            batch_size,
-            seq_length,
-            is_pair,
-            framework,
-            num_channels,
-            image_width,
-            image_height,
-            tokenizer,
+            preprocessor=preprocessor,
+            batch_size=batch_size,
+            seq_length=seq_length,
+            is_pair=is_pair,
+            framework=framework,
+            num_channels=num_channels,
+            image_width=image_width,
+            image_height=image_height,
+            tokenizer=tokenizer,
         )
         label_batch_size = compute_effective_axis_dimension(
             batch_size, fixed_dimension=self.default_fixed_batch, num_token_to_add=0
@@ -240,10 +240,10 @@ def generate_dummy_inputs(
 
         dummy_inputs = self._onnx_config.generate_dummy_inputs(
             tokenizer,
-            batch_size,
-            seq_length,
-            is_pair,
-            framework,
+            batch_size=batch_size,
+            seq_length=seq_length,
+            is_pair=is_pair,
+            framework=framework,
         )
         label_batch_size = compute_effective_axis_dimension(
             batch_size, fixed_dimension=self.default_fixed_batch, num_token_to_add=0


Test patch: