Fix TFElectraForMultipleChoice
Author: ydshieh
Pull request: yes

# What does this PR do?

Current `TFElectraForMultipleChoice` calls `TFElectraMainLayer` using positional arguments, and it doesn't have

```
        encoder_hidden_states,
        encoder_attention_mask
        past_key_values
        use_cache
```
so `inputs["output_attentions"]` is received as `encoder_hidden_states` by the main layer, etc.

This PR fixes it (using kwargs).

@Rocketknight1 @gante 



Comments:
_The documentation is not available anymore as the PR was closed or merged._

Hi, @gante . It does affect the results - I made a typo in the original message. 

```
so inputs["output_attentions"] is received as encoder_hidden_states by the main layer, etc.
```
(and this is why a correction is needed.)

You're absolutely right, it was being passed to the wrong variables. Thanks for lending your keen eye 👁️ 

This also means that `TFElectraForMultipleChoice` was not being properly tested -- how did tests like `test_pt_tf_model_equivalence`, which require `output_hidden_states = True` across the layers, were passing? (I've checked the [PT implementation](https://github.com/huggingface/transformers/blob/master/src/transformers/models/electra/modeling_electra.py#L1477), it is passing the keyword arguments correctly, so this mismatch should have been caught)

> This also means that `TFElectraForMultipleChoice` was not being properly tested -- how did tests like `test_pt_tf_model_equivalence`, which require `output_hidden_states = True` across the layers, were passing? (I've checked the [PT implementation](https://github.com/huggingface/transformers/blob/master/src/transformers/models/electra/modeling_electra.py#L1477), it is passing the keyword arguments correctly, so this mismatch should have been caught)

Current TF Electra Test's `prepare_config_and_inputs_for_common` only provides `inputs_dict = {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}`. So no `output_hidden_states` is used for the equivalence test.

In the enhanced `test_pt_tf_model_equivalence`, I manually set `output_hidden_states=True` and `output_attentions=True` in order to have a more complete check --> and this issue is then identified.


BTW, the pt/tf equivalence test uses TF model's `prepare_config_and_inputs_for_common` to prepare the inputs.

The equivalence test sets the `output_hidden_states` to `True` ([here](https://github.com/huggingface/transformers/blob/master/tests/test_modeling_tf_common.py#L355)), and on the line that you've changed this PR, I can confirm that `inputs["output_hidden_states"]` is `True` during the test :)

However, because it was set to `True` in the config, it may overwrite the `None` in the `ElectraMainLayer` (in [this function](https://github.com/huggingface/transformers/blob/525dbbf84a0d2933686281c513689da9794b7dd1/src/transformers/modeling_tf_utils.py#L295)). In other words, before this PR, `output_hidden_states` was not being set (because of the error you uncovered 🙌 ), so the config value took charge, and the test passed anyway.

In other words, we probably should be more strict about the use of keyword arguments, to avoid these sorts of errors -- especially because the config values may override a `None` :) 

Great analysis about `output_hidden_states` , @gante , you are right. Thank you!

However, the equivalence test only tests the first output:

https://github.com/huggingface/transformers/blob/525dbbf84a0d2933686281c513689da9794b7dd1/tests/test_modeling_tf_common.py#L384

I think the test will pass anyway even if there is an **actual** mismatch (i.e. even if the config doesn't take the charge).

----

I was thinking more why `encoder_hidden_states` gets value `False` and `encoder_attention_mask` gets `True` don't cause any problem - it turns out that these values are used only when the model is used as `decoder`, and `TFElectraForMultipleChoice` is not (so these wrong values are just ignored by the model without causing any exception)


![pycharm64_vWHXucHlIi](https://user-images.githubusercontent.com/2521628/152532303-370094d3-6e6f-4bfb-ac31-3a123fffce65.jpg)


----

@ydshieh Keep these fantastic PRs coming 🙏