Adds missing module_specs for usages of _LazyModule
Author: jkuball
Pull request: yes

# What does this PR do?

This PR adds a missing `__spec__` to the `_LazyModule` instances of all models.

When a module is missing a spec it could not be imported via `importlib.import_module`, which is what [torchmetrics does](https://github.com/PyTorchLightning/metrics/blob/master/torchmetrics/utilities/imports.py#L114), which is why I've found it in the first place.

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Related to #13321 (pr)
Fixes #15212 (issue)

## 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/master/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/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).~
- [x] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->


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

😍 exactly what i need

I have just moved the test. I also have a local commit lying around that adds the module_spec to all occurences of the LazyModule, but I am not that sure on where to put the tests for that.

Looking at the `test_modeling_{{cookiecutter.lowercase_modelname}}.py` template I could add the test to both possibilities of the `{{cookiecutter.camelcase_modelname}}ModelTester` -- but I am not sure on how to import the model beforehand, since I am not that sure on how the Lazy Modules are working exactly.

Can I just add a `import transformers.models.{{cookiecutter.lowercase_modelname}}` to all model test files, even outside of `is_torch_available` or would this break things?

Oh that's great! If you want to include that commit in this PR and rename it that would be great. Regarding tests, I don't think we need more than the test for the auto submodule and the test of transformers (since it's the same thing everywhere). To answer your question however, it does not need to be under a `is_torch_available()`.

To have the PR be perfectly complete, could you also add the change to the modeling template (if you don't have it in your commit already) as well as fix the test for transformers spec to be in a `unittest.TestCase`?

Okay, I figured that with the tests, but I wasn't sure.
In theory it wouldn't hurt, but yeah, it's probably okay to test the LazyModule once.

From my side this would now be mergeable, unless I made an error somewhere!

Edit: We *could* also get rid of the `Optional`-Hint for the `module_spec` to prevent those issues from arising later again (or at least the None-default).

Thank you so much for the wide fix! With the templates properly fixed, I don't think we will get new inits without the `module_spec` (if someone adds another new submodule, they will copy an existing init), so I think we're good.