[Doctest] added doctest changes for electra
# What does this PR do?
Adds Doctest fo Electra Pytorch

Issue: #16292

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [x] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?


## Who can review?
@ydshieh @patrickvonplaten

_The documentation is not available anymore as the PR was closed or merged._<|||||>Hi, I also got an error for `ElectraForPreTraining`.

~~I am still checking it.~~

Regarding `ElectraForPreTraining`, could you update that part with

```
>>> from transformers import ElectraForPreTraining, ElectraTokenizerFast
>>> import torch

>>> discriminator = ElectraForPreTraining.from_pretrained("google/electra-base-discriminator")
>>> tokenizer = ElectraTokenizerFast.from_pretrained("google/electra-base-discriminator")

>>> sentence = "The quick brown fox jumps over the lazy dog"
>>> fake_sentence = "The quick brown fox fake over the lazy dog"

>>> fake_tokens = tokenizer.tokenize(fake_sentence, add_special_tokens=True)
>>> fake_inputs = tokenizer.encode(fake_sentence, return_tensors="pt")
>>> discriminator_outputs = discriminator(fake_inputs)
>>> predictions = torch.round((torch.sign(discriminator_outputs[0]) + 1) / 2)

>>> fake_tokens
['[CLS]', 'the', 'quick', 'brown', 'fox', 'fake', 'over', 'the', 'lazy', 'dog', '[SEP]']

>>> predictions.squeeze().tolist()
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
```

`google/electra-small-discriminator` gives all `0` - not a very inspiring example :-)<|||||>sure<|||||>Hi @bhadreshpsavani , please ping me once you think it's ready for the next review  🙏 Thank you!<|||||>Hi @ydshieh,
Its ready, I have made the suggested changes and few more to fix the doctests<|||||>@patrickvonplaten Regarding `p a r i s`, check the fix in this PR

https://github.com/huggingface/transformers/pull/16698

I will help @bhadreshpsavani to finalize this PR regarding this part :)<|||||>Hello @ydshieh,
Since this fix for that issue is merged shall I pull the changes and make the required changes from `p a r i s` to `paris` ?<|||||>Looks good to me, tested locally and indeed rebasing on https://github.com/huggingface/transformers/pull/16698 solves the issue.<|||||>> Hello @ydshieh, Since this fix for that issue is merged shall I pull the changes and make the required changes from `p a r i s` to `paris` ?

Would be great if you can pull, rebase, and change the expected value to `paris` (after a verification) 😄 . Thanks<|||||>Hi @ydshieh,
I have updated the changes<|||||>Super nice PR! Thank you, @bhadreshpsavani , especially for the patience 💯 !
Merged (tested locally again -> all pass)<|||||>Hi @ydshieh,
Thank you for all the help and guidance!
Shall I create PR for other model as well?