Fix XLA fp16 and bf16 error checking
This PR fixed a bug introduced in https://github.com/huggingface/transformers/pull/15022 that will wrongfully throw an error when training with XLA device + fp16. `GPU_NUM_DEVICES` is unset by torch_xla in distributed training [here](https://github.com/pytorch/xla/blob/master/torch_xla/distributed/xla_multiprocessing.py#L229).

Tested using the following scripts:
```sh
GPU_NUM_DEVICES=8 python -m torch_xla.distributed.xla_spawn --num_gpus 8 language-modeling/run_mlm.py \
    --model_name_or_path bert-base-uncased \
    --dataset_name wikitext \
    --dataset_config_name wikitext-2-raw-v1 \
    --overwrite_output_dir true \
    --output_dir /tmp/test-mlm \
    --per_device_train_batch_size 10 \
    --do_eval \
    --fp16 true \
    --do_train \
    --num_train_epochs 3 \
    --optim adamw_torch_xla
```

Thanks to @Lokiiiiii @comaniac for reporting this issue.

cc @sgugger
_The documentation is not available anymore as the PR was closed or merged._<|||||>XLA already identifies the device type and publishes it in the environment variable for distributed training:
```
XRT_MULTI_PROCESSING_DEVICE="device:ordinal"
```

Eg: XRT_MULTI_PROCESSING_DEVICE=GPU:0
Eg: XRT_MULTI_PROCESSING_DEVICE=TPU:0

Refer to relevant device specific setup in PT-XLA: https://github.com/pytorch/xla/blob/master/torch_xla/distributed/xla_multiprocessing.py#L219-L276

Looking into single worker training now.<|||||>There might be a much easier solution:
The presence of environment variables of [TPU_NUM_DEVICES](https://github.com/pytorch/xla/blob/6e42e7cb3af01d9f8909e112a3be0148a87acad0/torch_xla/distributed/xla_multiprocessing.py#L79-L88) or [XRT_TPU_CONFIG](https://github.com/pytorch/xla/blob/e7e7fe406c7f276469d3e47ecd23e8c9423ab1b5/TROUBLESHOOTING.md) indicates a TPU environment.
The presence of environment variable GPU_NUM_DEVICES indicates a GPU environment.
<|||||>The most systematic logic should be like:

```
and not (self.device.type == "xla" and is_torch_tpu_available() and xm.xla_device() == gpu)
```

Inspired by this logic, it might be better to have an API to return the current torch_xla device so that we could use it here:

```
and not(self.device_type "xla" and get_torch_xla_device() != gpu)
```<|||||>I'm fine with both solutions :-)<|||||>I just realized torch_xla already has the API to distinguish different backends.
```
torch_xla._XLAC._xla_real_devices([str(device)])
```
For GPU, it returns
```
['GPU:0']
```
For TPU, it returns
```
['TPU:0']
```
I'll try to implement it with this API.<|||||>It looks like "torch.device" as a type hint can cause CI failure if pytorch is not installed. I've removed it.