Better booleans handling in the TF models
Author: jplu
Pull request: yes

# What does this PR do?

This PR provides a better handling for the booleans. More precisely, the execution mode (eager or graph) is detected and the booleans are accordingly set to have a proper execution. Nevertheless, this brings a small breaking change in graph mode, it is not possible anymore to update the booleans with the model parameters but only with through the config and the `return_dict` is forced to be `True`.

Now to activate the `output_attentions` or `output_hidden_states` values in graph mode one has to create the model config like:
```
config = XConfig.from_pretrained("name", output_attentions=True, output_hidden_states=True)
```



Comments:
Thanks @patrickvonplaten!

As detailed in the first post, boolean parameters cannot be set during the model call in graph mode. This is the major feature brought by this PR. I wanted to focus of TF T5 and TF Bart on a later PR once this logic is ok at least for all the others.

There is now a better warning message.

> You say there is a breaking change in graph mode. Does it mean that currently, both eager & graph mode can handle arguments through the configuration & through the function call? I'm unsure on where we stand on this currently.

Yes, both can be done, but it raises issues when through the function call in graph mode. So this PR fixes this with a better handling of this case.

> It seems like the tests that would be impacted by these changes are the slow tests. Have you run the slow tests? If not, could you run the slow tensorflow tests on this PR? If you don't know how to do that, happy to show you how for next time.

This PR partially fixes these tests. Remembert that they do not pass for T5 and BART for the reasons expressed by Patrick. These models, including the saved model tests, will be fixed in same time in a PR just after this one.

Also, in a future PR I will rethink the way the attributes are handled in all the layers.

> Yes, both can be done, but it raises issues when through the function call in graph mode. So this PR fixes this with a better handling of this case.

So right now it fails, and with this PR it also fails but with better error handling?

> This PR partially fixes these tests. Remembert that they do not pass for T5 and BART for the reasons expressed by Patrick. These models, including the saved model tests, will be fixed in same time in a PR just after this one.

I meant *all* the slow tests, not only the saved models with saved attentions tests. And this PR doesn't only impact the T5 and BART models, so re-running all the slow tests on this PR seems necessary.

> So right now it fails, and with this PR it also fails but with better error handling?

No, before nothing was working in graph mode when the boolean was updated through the function call. Now, I disabled this functionality and there is no more fail, and everything works properly and as expected in eager+graph mode except T5 and BART in graph mode, which will be handled in a later PR.

> I meant all the slow tests, not only the saved models with saved attentions tests. And this PR doesn't only impact the T5 and BART models, so re-running all the slow tests on this PR seems necessary.

Ok, I will run all of them.

@LysandreJik All the slow tests are passing but two:

- `tests/test_modeling_tf_transfo_xl.py::TFTransfoXLModelLanguageGenerationTest::test_lm_generate_transfo_xl_wt103`, I started to see that with @patrickvonplaten 
- `tests/test_utils_check_copies.py::CopyCheckTester::test_is_copy_consistent`, @sgugger any idea why this test don't pass anymore? Here the output:
```
def test_is_copy_consistent(self):
        # Base copy consistency
>       self.check_copy_consistency(
            "# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead",
            "BertLMPredictionHead",
            REFERENCE_CODE + "\n",
        )

tests\test_utils_check_copies.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  
tests\test_utils_check_copies.py:59: in check_copy_consistency
    self.assertTrue(len(check_copies.is_copy_consistent(fname)) == 0)
E   AssertionError: False is not true
```

@LysandreJik Any other needs for this PR to be merged?

I investigated why the `test_is_copy_consistent` test failed, that is probably because you launched your command from inside the `tests/` directory, and it has a path hardcoded to `src/transformers`, and therefore cannot find the path `tests/src/transformers`. 

No issues there it seems! Reviewing a final time and merging if all is good.

@patrickvonplaten you haven't approved this PR, do you want to give it a final look and merge if ok for you?

> @LysandreJik All the slow tests are passing but two:
> 
> * `tests/test_modeling_tf_transfo_xl.py::TFTransfoXLModelLanguageGenerationTest::test_lm_generate_transfo_xl_wt103`, I started to see that with @patrickvonplaten
> * `tests/test_utils_check_copies.py::CopyCheckTester::test_is_copy_consistent`, @sgugger any idea why this test don't pass anymore? Here the output:
> 
> ```
> def test_is_copy_consistent(self):
>         # Base copy consistency
> >       self.check_copy_consistency(
>             "# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead",
>             "BertLMPredictionHead",
>             REFERENCE_CODE + "\n",
>         )
> 
> tests\test_utils_check_copies.py:71:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  
> tests\test_utils_check_copies.py:59: in check_copy_consistency
>     self.assertTrue(len(check_copies.is_copy_consistent(fname)) == 0)
> E   AssertionError: False is not true
> ```

I'll investigate for `tests/test_modeling_tf_transfo_xl.py::TFTransfoXLModelLanguageGenerationTest::test_lm_generate_transfo_xl_wt103` -> thanks for pinging me on that! PR is good for me!