Add datasets.Dataset to trainer type hints
# What does this PR do?

This fixes a minor type hinting issue. `Trainer.__init__` currently assumes that `train_dataset` (if not `None`) is of type `torch.util.data.Dataset` (or `Dataset` for short), but that is a generic type (just as e.g. `List` is generic and needs to be "filled" as in `List[str]`). This method also works perfectly well with `datasets.Dataset`, although this class _cannot_ be expressed with a generic type. There are two options:

1. Fix this upstream in Datasets by turning `datasets.Dataset` into a generic type or
2. Replace `Optional[Dataset]` with `Union[Dataset, datasets.Dataset, None]` in `Trainer` and `Seq2SeqTrainer`

This PR implements option 2.

## 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?
- [ ] 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?

@sgugger
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_17149). All of your documentation changes will be reflected on that endpoint.<|||||>I don't think this fix is right as a `datasets.Dataset` should be recognized by the `Dataset` type (it implements `__getitem__` and `__len__`). <|||||>The problem there is that https://github.com/pytorch/pytorch/blob/da3ebaebee61c9594a0fb5d74ece6a1da2eff33a/torch/utils/data/dataset.py#L34 declares `Dataset` as a generic type - and some type checkers complain that `datasets.Dataset` violates the protocol by virtue of not being a generic type. I can see three options for resolving this:

1) Turn `datasets.Dataset` into a generic type
2) Implement another protocol that works just like the linked `Dataset` generic type except it _isn’t_ generic, and make that the type for `train_dataset`; `Dataset` would satisfy this protocol too, I believe
3) Just allow `datasets.Dataset` alongside `Dataset` (i.e. this PR)

3 is the easiest, 2 feels hacky to me, 1 might be workable but might be a breaking change for `datasets.Dataset` typing? Not sure tbh.<|||||>We also don't care at all, in honesty. We don't use type hints to satisfy the whims of type-checkers, because this is Python, not a typed language, and there is only so much a type hint can cover. We use type hints so that the documentation is clear on what is expected when the user checks it. In this instance `Dataset` is perfect for this purpose, so we won't add anything else just for the sake of type-checkers.<|||||>I mean, up to you - suppressing type hinter complaints for those two lines is a trivial matter even now. Solving the issue makes VSCode very slightly more usable for dev, and marginally less confusing for its users, but if you think this change would leave the docs (which are undoubtedly used by many more users) worse off, feel free to close this PR.<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.