add doctests to TF ViT
# What does this PR do?

Add doctests for the TF version of ViT

Fixes # (issue)
#16292 

## Before submitting
- [ ] 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.
- [ ] 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).
- [ ] Did you write any new necessary tests?


## Who can review?
@patrickvonplaten 

_The documentation is not available anymore as the PR was closed or merged._<|||||>Hi, @johko

Thank you for this PR! Really appreciated.

I just realized that we have [PT_VISION_BASE_MODEL_SAMPLE](https://github.com/huggingface/transformers/blob/c85547af2b69f9082bcd7bac97092b1d162f3fdc/src/transformers/utils/doc.py#L541), but not `TF_VISION_BASE_MODEL_SAMPLE`.

Ideally, we would like to re-use code sample in [doc.py](https://github.com/huggingface/transformers/blob/main/src/transformers/utils/doc.py). I will need to discuss with the team to make a decision.

I will come back to you once we have a decision. Sorry for the inconvenience!<|||||>Hi, @johko

After the discussion with the team, we think it would be really better for us to add the following in `doc.py`

```
TF_VISION_BASE_MODEL_SAMPLE
TF_VISION_SEQ_CLASS_SAMPLE
```
(as already done in PyTorch side).

I will open a PR to add these, and keep you updated when that PR is merged. Thank you.<|||||>@johko 

```
TF_VISION_BASE_MODEL_SAMPLE
TF_VISION_SEQ_CLASS_SAMPLE
```
are added in this PR (and already merged to `main`) #16477

Once you pull the upstream's `main` in your local clone's `main` (or `master`), and rebase or merge it into your working branch, the process is just a matter of using **@add_code_sample_docstrings** together with **expected_output**, **checkpoint**, etc. You can take this as a reference:

https://github.com/huggingface/transformers/pull/16363/files#diff-5707805d290617078f996faf1138de197fa813f78c0aa5ea497e73b5228f1103

Regarding the checkpoint to use: 

- TFViTModel
  "google/vit-base-patch16-224-in21k"

- TFViTForImageClassification
  "google/vit-base-patch16-224"

I manually checked the code sample. Let me know if you encounter any issue.<|||||>@ydshieh 
Thanks for the explanation, I'll look into it and implement the changes within the next days<|||||>@ydshieh 
Ah, sorry I messed up the history now, I'm still getting used to the VS Code Git plugin.
But I added the `add_code_sample_docstrings` decorator to `modeling_tf_vit.py` now<|||||>@johko 

Thank you for the update!

Regarding the commit history, could you try to fix it. I never need to deal with this situation so far, but here are a few threads I could find (potentially) relevant:

- https://stackoverflow.com/questions/44000096/github-pull-request-displaying-too-many-file-changes
- https://stackoverflow.com/questions/56708751/github-pull-requests-showing-more-and-more-old-merges

Please note that these links are merely an attempt to fix the current situation, I could not guarantee that the mentioned methods would work well and without any problem.

In any case, since the **real** change is very small, you can always update the master/main branch of your local clone, and create a new branch + add the changes there, then open a new PR.

Thank you for your understanding!<|||||>Thank you, I'll look into it and try to fix it. In the end, as you mentioned I might always just make a new branch from my local master<|||||>@ydshieh I'll close this PR and create a new one with a clean history. It seems VS Code used _git sync_ and this messes up the history after a rebase<|||||>No problem, @johko . Thank you for the effort!