fp16 compatibility
Author: JiTingyu
Pull request: no

我使用的是RTX3090，cuda11.0，系统是ubuntu 18.04
现在遇到问题如下，希望请教一下解决方法
^MEpoch:   0%|          | 0/2 [00:00<?, ?it/s]
^MIteration:   0%|          | 0/10860 [00:00<?, ?it/s]^[[A^MIteration:   0%|          | 0/10860 [00:03<?, ?it/s]
^MEpoch:   0%|          | 0/2 [00:03<?, ?it/s]
Selected optimization level O1:  Insert automatic casts around Pytorch functions and Tensor methods.

Defaults for this optimization level are:
enabled                : True
opt_level              : O1
cast_model_type        : None
patch_torch_functions  : True
keep_batchnorm_fp32    : None
master_weights         : None
loss_scale             : dynamic
Processing user overrides (additional kwargs that are not None)...
After processing overrides, optimization options are:
enabled                : True
opt_level              : O1
cast_model_type        : None
patch_torch_functions  : True
keep_batchnorm_fp32    : None
master_weights         : None
loss_scale             : dynamic
Warning:  multi_tensor_applier fused unscale kernel is unavailable, possibly because apex was installed without --cuda_ext --cpp_ext. Using Python fallback.  Original ImportError was: ModuleNotFoundError("No module named 'amp_C'",)
Traceback (most recent call last):
  File "./examples/run_cls.py", line 645, in <module>
    main()
  File "./examples/run_cls.py", line 533, in main
    global_step, tr_loss = train(args, train_dataset, model, tokenizer)
  File "./examples/run_cls.py", line 159, in train
    outputs = model(**inputs)
  File "/home/jitingyu/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/jitingyu/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 161, in forward
    outputs = self.parallel_apply(replicas, inputs, kwargs)
  File "/home/jitingyu/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 171, in parallel_apply
    return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
  File "/home/jitingyu/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/parallel_apply.py", line 86, in parallel_apply
    output.reraise()
  File "/home/jitingyu/.conda/envs/pytorch/lib/python3.6/site-packages/torch/_utils.py", line 428, in reraise
    raise self.exc_type(msg)
StopIteration: Caught StopIteration in replica 0 on device 0.
Original Traceback (most recent call last):
  File "/home/jitingyu/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker
    output = module(*input, **kwargs)
  File "/home/jitingyu/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/jitingyu/AwesomeMRC-master/transformer-mrc/transformers/modeling_albert.py", line 688, in forward
    inputs_embeds=inputs_embeds
  File "/home/jitingyu/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/jitingyu/AwesomeMRC-master/transformer-mrc/transformers/modeling_albert.py", line 524, in forward
    extended_attention_mask = extended_attention_mask.to(dtype=next(self.parameters()).dtype) # fp16 compatibility
StopIteration

Comments:
Please fill in the issue template for us to help you. You seem to be on an older transformers version, this was fixed in recent versions.

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/master/CONTRIBUTING.md) are likely to be ignored.