ValueError: transformers.models.auto.__spec__ is None. causing import errors
## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.15.0
- Platform: Colaboratory
- Python version: 3.7.12

### Who can help

@LysandreJik

<!-- Your issue 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, DeBERTa, DeBERTa-v2, ELECTRA, MobileBert, SqueezeBert: @LysandreJik
- T5, BART, Marian, Pegasus, EncoderDecoder: @patrickvonplaten
- Blenderbot, MBART: @patil-suraj
- Longformer, Reformer, TransfoXL, XLNet, FNet, BigBird: @patrickvonplaten
- FSMT: @stas00
- Funnel: @sgugger
- GPT-2, GPT: @patrickvonplaten, @LysandreJik
- RAG, DPR: @patrickvonplaten, @lhoestq
- TensorFlow: @Rocketknight1
- JAX/Flax: @patil-suraj
- TAPAS, LayoutLM, LayoutLMv2, LUKE, ViT, BEiT, DEiT, DETR, CANINE: @NielsRogge
- GPT-Neo, GPT-J, CLIP: @patil-suraj
- Wav2Vec2, HuBERT, SpeechEncoderDecoder, UniSpeech, UniSpeechSAT, SEW, SEW-D, Speech2Text: @patrickvonplaten, @anton-l

If the model isn't in the list, ping @LysandreJik who will redirect you to the correct contributor.

Library:

- Benchmarks: @patrickvonplaten
- Deepspeed: @stas00
- Ray/raytune: @richardliaw, @amogkam
- Text generation: @patrickvonplaten @narsil
- Tokenizers: @SaulLu
- Trainer: @sgugger
- Pipelines: @Narsil
- Speech: @patrickvonplaten, @anton-l
- Vision: @NielsRogge, @sgugger

Documentation: @sgugger

Model hub:

- for issues with a model, report at https://discuss.huggingface.co/ and tag the model's creator.

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

For research projetcs, please ping the contributor directly. For example, on the following projects:

- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

## Information

Hello, this code was working last week but today I am getting a 'ValueError: transformers.models.auto.__spec__ is None' error which is causing errors when trying to import  other Libraries. I noted a similar issue #12904 but this has been resolved and closed last year.

Model I am using (Bert, XLNet ...): BERT

The problem arises when using: Transformers

My code:
```python
# Import all libraries
import pandas as pd
import numpy as np
import re


# Huggingface transformers
import transformers
from transformers import BertModel,BertTokenizer,AdamW, get_linear_schedule_with_warmup
print(transformers.__version__)
print(transformers.models.auto.__spec__)

import torch
from torch import nn 
from torch.utils.data import DataLoader,Dataset,RandomSampler, SequentialSampler
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint

from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, precision_recall_fscore_support

import seaborn as sns
from pylab import rcParams
import matplotlib.pyplot as plt
from matplotlib import rc
%matplotlib inline

RANDOM_SEED = 42
np.random.seed(RANDOM_SEED)
torch.manual_seed(RANDOM_SEED)

import os
os.environ["CUDA_VISIBLE_DEVICES"]="0"
device = torch.device("cpu")
```

The Output:

```python
4.15.0
None
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-10-3e575e7ee253> in <module>()
     12 from torch import nn
     13 from torch.utils.data import DataLoader,Dataset,RandomSampler, SequentialSampler
---> 14 import pytorch_lightning as pl
     15 from pytorch_lightning.callbacks import ModelCheckpoint
     16 

10 frames
/usr/local/lib/python3.7/dist-packages/pytorch_lightning/__init__.py in <module>()
     18 _PROJECT_ROOT = os.path.dirname(_PACKAGE_ROOT)
     19 
---> 20 from pytorch_lightning.callbacks import Callback  # noqa: E402
     21 from pytorch_lightning.core import LightningDataModule, LightningModule  # noqa: E402
     22 from pytorch_lightning.trainer import Trainer  # noqa: E402

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/callbacks/__init__.py in <module>()
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
---> 14 from pytorch_lightning.callbacks.base import Callback
     15 from pytorch_lightning.callbacks.device_stats_monitor import DeviceStatsMonitor
     16 from pytorch_lightning.callbacks.early_stopping import EarlyStopping

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/callbacks/base.py in <module>()
     24 
     25 import pytorch_lightning as pl
---> 26 from pytorch_lightning.utilities.types import STEP_OUTPUT
     27 
     28 

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/types.py in <module>()
     23 from torch.optim.lr_scheduler import _LRScheduler, ReduceLROnPlateau
     24 from torch.utils.data import DataLoader
---> 25 from torchmetrics import Metric
     26 
     27 _NUMBER = Union[int, float]

/usr/local/lib/python3.7/dist-packages/torchmetrics/__init__.py in <module>()
     12 _PROJECT_ROOT = os.path.dirname(_PACKAGE_ROOT)
     13 
---> 14 from torchmetrics import functional  # noqa: E402
     15 from torchmetrics.aggregation import CatMetric, MaxMetric, MeanMetric, MinMetric, SumMetric  # noqa: E402
     16 from torchmetrics.audio import (  # noqa: E402

/usr/local/lib/python3.7/dist-packages/torchmetrics/functional/__init__.py in <module>()
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
---> 14 from torchmetrics.functional.audio.pit import permutation_invariant_training, pit, pit_permutate
     15 from torchmetrics.functional.audio.sdr import scale_invariant_signal_distortion_ratio, sdr, signal_distortion_ratio
     16 from torchmetrics.functional.audio.si_sdr import si_sdr

/usr/local/lib/python3.7/dist-packages/torchmetrics/functional/audio/__init__.py in <module>()
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
---> 14 from torchmetrics.functional.audio.pit import permutation_invariant_training, pit, pit_permutate  # noqa: F401
     15 from torchmetrics.functional.audio.sdr import (  # noqa: F401
     16     scale_invariant_signal_distortion_ratio,

/usr/local/lib/python3.7/dist-packages/torchmetrics/functional/audio/pit.py in <module>()
     22 from torchmetrics.utilities import _future_warning
     23 from torchmetrics.utilities.checks import _check_same_shape
---> 24 from torchmetrics.utilities.imports import _SCIPY_AVAILABLE
     25 
     26 # _ps_dict: cache of permutations

/usr/local/lib/python3.7/dist-packages/torchmetrics/utilities/imports.py in <module>()
     90 _TQDM_AVAILABLE: bool = _module_available("tqdm")
     91 _TRANSFORMERS_AVAILABLE: bool = _module_available("transformers")
---> 92 _TRANSFORMERS_AUTO_AVAILABLE = _module_available("transformers.models.auto")
     93 _PESQ_AVAILABLE: bool = _module_available("pesq")
     94 _SACREBLEU_AVAILABLE: bool = _module_available("sacrebleu")

/usr/local/lib/python3.7/dist-packages/torchmetrics/utilities/imports.py in _module_available(module_path)
     34     """
     35     try:
---> 36         return find_spec(module_path) is not None
     37     except AttributeError:
     38         # Python 3.6

/usr/lib/python3.7/importlib/util.py in find_spec(name, package)
    112         else:
    113             if spec is None:
--> 114                 raise ValueError('{}.__spec__ is None'.format(name))
    115             return spec
    116 

ValueError: transformers.models.auto.__spec__ is None
```

## To reproduce

Steps to reproduce the behavior:

```python
import transformers
print(transformers.__version__)
print(transformers.models.auto.__spec__)

4.15.0
None
```

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

This code ran perfectly and all Libraries were imported last week. I made no changes to this code since but it produced the above error today.

Having the same issue too! Exact same reproducible code + transformers version.<|||||>Same issue with `transformers 4.10.0, 4.10.2` and `pytorch-lightning 1.3.5`<|||||>I have the same issue :(<|||||>Installing  `torchmetrics==0.6.2` helped in my case.<|||||>Seems like [this PR](https://github.com/huggingface/transformers/pull/13321) needs to be copied for [this line of code](https://github.com/huggingface/transformers/blob/master/src/transformers/models/auto/__init__.py#L251).<|||||>> Installing `torchmetrics==0.6.2` helped in my case.

On G.Colab I had the same issue with `transformers==4.15.0` and `pytorch_lightning==1.5.7` installed. 

Solved by installing `torchmetrics==0.6.2` . 

Thank you 