[testing] test_modeling_deberta.py is failing
Author: stas00
Pull request: no

```
USE_CUDA=1 pytest tests/test_modeling_deberta.py
```

```
====================================================================== test session starts =======================================================================
platform linux -- Python 3.8.5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /mnt/nvme1/code/huggingface/transformers-master
plugins: xdist-2.1.0, forked-1.3.0, typeguard-2.9.1, flake8-1.0.6, hydra-core-1.0.0, cov-2.10.1, instafail-0.4.2, flakefinder-1.0.0
collected 33 items                                                                                                                                               

tests/test_modeling_deberta.py ...F.FssFs............s..F....sss                                                                                           [100%]

============================================================================ FAILURES ============================================================================
______________________________________________________________ DebertaModelTest.test_deberta_model _______________________________________________________________

self = <tests.test_modeling_deberta.DebertaModelTest testMethod=test_deberta_model>

    def test_deberta_model(self):
        config_and_inputs = self.model_tester.prepare_config_and_inputs()
>       self.model_tester.create_and_check_deberta_model(*config_and_inputs)

tests/test_modeling_deberta.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_modeling_deberta.py:159: in create_and_check_deberta_model
    sequence_output = model(input_ids, attention_mask=input_mask, token_type_ids=token_type_ids)[0]
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:891: in forward
    encoder_outputs = self.encoder(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:401: in forward
    hidden_states = layer_module(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:324: in forward
    attention_output = self.attention(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:257: in forward
    self_output = self.self(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = DisentangledSelfAttention(
  (in_proj): Linear(in_features=32, out_features=96, bias=False)
  (dropout): StableDropout()
)
hidden_states = tensor([[[-0.1865,  1.6041, -1.3552,  ..., -1.2947, -0.9667,  0.9630],
         [ 1.1352,  0.1829,  0.3669,  ..., -2.4...        [-0.3743, -0.0251, -0.8356,  ..., -0.9786, -1.3914, -1.9630]]],
       device='cuda:0', grad_fn=<MulBackward0>)
attention_mask = tensor([[[[1, 1, 1, 0, 1, 1, 0],
          [1, 1, 1, 0, 1, 1, 0],
          [1, 1, 1, 0, 1, 1, 0],
          [0, 0, 0,..., 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0],
          [0, 1, 1, 1, 0, 0, 1]]]], device='cuda:0', dtype=torch.uint8)
return_att = False, query_states = None, relative_pos = None, rel_embeddings = None

    def forward(
        self,
        hidden_states,
        attention_mask,
        return_att=False,
        query_states=None,
        relative_pos=None,
        rel_embeddings=None,
    ):
        """Call the module
    
        Args:
            hidden_states (:obj:`torch.FloatTensor`):
                Input states to the module usally the output from previous layer, it will be the Q,K and V in `Attention(Q,K,V)`
    
            attention_mask (:obj:`torch.ByteTensor`):
                An attention mask matrix of shape [`B`, `N`, `N`] where `B` is the batch size, `N` is the maxium sequence length in which element [i,j] = `1` means the `i` th token in the input can attend to the `j` th token.                                                                                                   
    
            return_att (:obj:`bool`, optional):
                Whether return the attention maxitrix.
    
            query_states (:obj:`torch.FloatTensor`, optional):
                The `Q` state in `Attention(Q,K,V)`.
    
            relative_pos (:obj:`torch.LongTensor`):
                The relative position encoding between the tokens in the sequence. It's of shape [`B`, `N`, `N`] with values ranging in [`-max_relative_positions`, `max_relative_positions`].                                                                                                                                      
    
            rel_embeddings (:obj:`torch.FloatTensor`):
                The embedding of relative distances. It's a tensor of shape [:math:`2 \\times \\text{max_relative_positions}`, `hidden_size`].
    
    
        """
        if query_states is None:
            qp = self.in_proj(hidden_states)  # .split(self.all_head_size, dim=-1)
            query_layer, key_layer, value_layer = self.transpose_for_scores(qp).chunk(3, dim=-1)
        else:
    
            def linear(w, b, x):
                if b is not None:
                    return torch.matmul(x, w.t()) + b.t()
                else:
                    return torch.matmul(x, w.t())  # + b.t()
    
            ws = self.in_proj.weight.chunk(self.num_attention_heads * 3, dim=0)
            qkvw = [torch.cat([ws[i * 3 + k] for i in range(self.num_attention_heads)], dim=0) for k in range(3)]
            qkvb = [None] * 3
    
            q = linear(qkvw[0], qkvb[0], query_states)
            k, v = [linear(qkvw[i], qkvb[i], hidden_states) for i in range(1, 3)]
            query_layer, key_layer, value_layer = [self.transpose_for_scores(x) for x in [q, k, v]]
    
        query_layer += self.transpose_for_scores(self.q_bias[None, None, :])
>       value_layer += self.transpose_for_scores(self.v_bias[None, None, :])
E       RuntimeError: diff_view_meta->output_nr_ == 0 INTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1602659340682/work/torch/csrc/autograd/variable.cpp":352, please report a bug to PyTorch.

src/transformers/modeling_deberta.py:575: RuntimeError
__________________________________________________________ DebertaModelTest.test_feed_forward_chunking ___________________________________________________________

self = <tests.test_modeling_deberta.DebertaModelTest testMethod=test_feed_forward_chunking>

    def test_feed_forward_chunking(self):
        (
            original_config,
            inputs_dict,
        ) = self.model_tester.prepare_config_and_inputs_for_common()
        for model_class in self.all_model_classes:
            torch.manual_seed(0)
            config = copy.deepcopy(original_config)
            model = model_class(config)
            model.to(torch_device)
            model.eval()
    
>           hidden_states_no_chunk = model(**self._prepare_for_class(inputs_dict, model_class))[0]

tests/test_modeling_common.py:617: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:891: in forward
    encoder_outputs = self.encoder(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:401: in forward
    hidden_states = layer_module(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:324: in forward
    attention_output = self.attention(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:257: in forward
    self_output = self.self(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = DisentangledSelfAttention(
  (in_proj): Linear(in_features=32, out_features=96, bias=False)
  (dropout): StableDropout()
)
hidden_states = tensor([[[-0.1510,  1.7101, -1.2962,  ...,  1.5861, -0.6766,  0.3315],
         [ 0.0000, -0.0000, -0.0000,  ...,  0.0...        [-0.0000, -0.0000, -0.0000,  ...,  0.0000,  0.0000,  0.0000]]],
       device='cuda:0', grad_fn=<MulBackward0>)
attention_mask = tensor([[[[1, 0, 0, 1, 1, 1, 0],
          [0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0],
          [1, 0, 0,..., 0, 1, 1, 0],
          [1, 0, 0, 0, 1, 1, 0],
          [0, 0, 0, 0, 0, 0, 0]]]], device='cuda:0', dtype=torch.uint8)
return_att = False, query_states = None, relative_pos = None, rel_embeddings = None

    def forward(
        self,
        hidden_states,
        attention_mask,
        return_att=False,
        query_states=None,
        relative_pos=None,
        rel_embeddings=None,
    ):
        """Call the module
    
        Args:
            hidden_states (:obj:`torch.FloatTensor`):
                Input states to the module usally the output from previous layer, it will be the Q,K and V in `Attention(Q,K,V)`
    
            attention_mask (:obj:`torch.ByteTensor`):
                An attention mask matrix of shape [`B`, `N`, `N`] where `B` is the batch size, `N` is the maxium sequence length in which element [i,j] = `1` means the `i` th token in the input can attend to the `j` th token.                                                                                                   
    
            return_att (:obj:`bool`, optional):
                Whether return the attention maxitrix.
    
            query_states (:obj:`torch.FloatTensor`, optional):
                The `Q` state in `Attention(Q,K,V)`.
    
            relative_pos (:obj:`torch.LongTensor`):
                The relative position encoding between the tokens in the sequence. It's of shape [`B`, `N`, `N`] with values ranging in [`-max_relative_positions`, `max_relative_positions`].                                                                                                                                      
    
            rel_embeddings (:obj:`torch.FloatTensor`):
                The embedding of relative distances. It's a tensor of shape [:math:`2 \\times \\text{max_relative_positions}`, `hidden_size`].
    
    
        """
        if query_states is None:
            qp = self.in_proj(hidden_states)  # .split(self.all_head_size, dim=-1)
            query_layer, key_layer, value_layer = self.transpose_for_scores(qp).chunk(3, dim=-1)
        else:
    
            def linear(w, b, x):
                if b is not None:
                    return torch.matmul(x, w.t()) + b.t()
                else:
                    return torch.matmul(x, w.t())  # + b.t()
    
            ws = self.in_proj.weight.chunk(self.num_attention_heads * 3, dim=0)
            qkvw = [torch.cat([ws[i * 3 + k] for i in range(self.num_attention_heads)], dim=0) for k in range(3)]
            qkvb = [None] * 3
    
            q = linear(qkvw[0], qkvb[0], query_states)
            k, v = [linear(qkvw[i], qkvb[i], hidden_states) for i in range(1, 3)]
            query_layer, key_layer, value_layer = [self.transpose_for_scores(x) for x in [q, k, v]]
    
        query_layer += self.transpose_for_scores(self.q_bias[None, None, :])
>       value_layer += self.transpose_for_scores(self.v_bias[None, None, :])
E       RuntimeError: diff_view_meta->output_nr_ == 0 INTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1602659340682/work/torch/csrc/autograd/variable.cpp":352, please report a bug to PyTorch.

src/transformers/modeling_deberta.py:575: RuntimeError
_______________________________________________________ DebertaModelTest.test_for_sequence_classification ________________________________________________________

self = <tests.test_modeling_deberta.DebertaModelTest testMethod=test_for_sequence_classification>

    def test_for_sequence_classification(self):
        config_and_inputs = self.model_tester.prepare_config_and_inputs()
>       self.model_tester.create_and_check_deberta_for_sequence_classification(*config_and_inputs)

tests/test_modeling_deberta.py:214: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_modeling_deberta.py:177: in create_and_check_deberta_for_sequence_classification
    loss, logits = model(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:987: in forward
    outputs = self.deberta(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:891: in forward
    encoder_outputs = self.encoder(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:401: in forward
    hidden_states = layer_module(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:324: in forward
    attention_output = self.attention(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:257: in forward
    self_output = self.self(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = DisentangledSelfAttention(
  (in_proj): Linear(in_features=32, out_features=96, bias=False)
  (dropout): StableDropout()
)
hidden_states = tensor([[[-6.2643e-01, -1.6159e+00,  1.4385e+00,  ...,  1.2083e+00,
          -7.2520e-02,  4.6405e-01],
         [ 7....62e-01,  6.8716e-01,  ..., -1.0658e+00,
          -9.1048e-01,  4.0098e-01]]], device='cuda:0', grad_fn=<MulBackward0>)
attention_mask = tensor([[[[1, 1, 1, 1, 1, 0, 0],
          [1, 1, 1, 1, 1, 0, 0],
          [1, 1, 1, 1, 1, 0, 0],
          [1, 1, 1,..., 0, 0, 0, 0],
          [1, 1, 1, 1, 0, 1, 1],
          [1, 1, 1, 1, 0, 1, 1]]]], device='cuda:0', dtype=torch.uint8)
return_att = False, query_states = None, relative_pos = None, rel_embeddings = None

    def forward(
        self,
        hidden_states,
        attention_mask,
        return_att=False,
        query_states=None,
        relative_pos=None,
        rel_embeddings=None,
    ):
        """Call the module
    
        Args:
            hidden_states (:obj:`torch.FloatTensor`):
                Input states to the module usally the output from previous layer, it will be the Q,K and V in `Attention(Q,K,V)`
    
            attention_mask (:obj:`torch.ByteTensor`):
                An attention mask matrix of shape [`B`, `N`, `N`] where `B` is the batch size, `N` is the maxium sequence length in which element [i,j] = `1` means the `i` th token in the input can attend to the `j` th token.                                                                                                   
    
            return_att (:obj:`bool`, optional):
                Whether return the attention maxitrix.
    
            query_states (:obj:`torch.FloatTensor`, optional):
                The `Q` state in `Attention(Q,K,V)`.
    
            relative_pos (:obj:`torch.LongTensor`):
                The relative position encoding between the tokens in the sequence. It's of shape [`B`, `N`, `N`] with values ranging in [`-max_relative_positions`, `max_relative_positions`].                                                                                                                                      
    
            rel_embeddings (:obj:`torch.FloatTensor`):
                The embedding of relative distances. It's a tensor of shape [:math:`2 \\times \\text{max_relative_positions}`, `hidden_size`].
    
    
        """
        if query_states is None:
            qp = self.in_proj(hidden_states)  # .split(self.all_head_size, dim=-1)
            query_layer, key_layer, value_layer = self.transpose_for_scores(qp).chunk(3, dim=-1)
        else:
    
            def linear(w, b, x):
                if b is not None:
                    return torch.matmul(x, w.t()) + b.t()
                else:
                    return torch.matmul(x, w.t())  # + b.t()
    
            ws = self.in_proj.weight.chunk(self.num_attention_heads * 3, dim=0)
            qkvw = [torch.cat([ws[i * 3 + k] for i in range(self.num_attention_heads)], dim=0) for k in range(3)]
            qkvb = [None] * 3
    
            q = linear(qkvw[0], qkvb[0], query_states)
            k, v = [linear(qkvw[i], qkvb[i], hidden_states) for i in range(1, 3)]
            query_layer, key_layer, value_layer = [self.transpose_for_scores(x) for x in [q, k, v]]
    
        query_layer += self.transpose_for_scores(self.q_bias[None, None, :])
>       value_layer += self.transpose_for_scores(self.v_bias[None, None, :])
E       RuntimeError: diff_view_meta->output_nr_ == 0 INTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1602659340682/work/torch/csrc/autograd/variable.cpp":352, please report a bug to PyTorch.

src/transformers/modeling_deberta.py:575: RuntimeError
_________________________________________________________ DebertaModelTest.test_resize_tokens_embeddings _________________________________________________________

self = <tests.test_modeling_deberta.DebertaModelTest testMethod=test_resize_tokens_embeddings>

    def test_resize_tokens_embeddings(self):
        (
            original_config,
            inputs_dict,
        ) = self.model_tester.prepare_config_and_inputs_for_common()
        if not self.test_resize_embeddings:
            return
    
        for model_class in self.all_model_classes:
            config = copy.deepcopy(original_config)
            model = model_class(config)
            model.to(torch_device)
    
            if self.model_tester.is_training is False:
                model.eval()
    
            model_vocab_size = config.vocab_size
            # Retrieve the embeddings and clone theme
            model_embed = model.resize_token_embeddings(model_vocab_size)
            cloned_embeddings = model_embed.weight.clone()
    
            # Check that resizing the token embeddings with a larger vocab size increases the model's vocab size
            model_embed = model.resize_token_embeddings(model_vocab_size + 10)
            self.assertEqual(model.config.vocab_size, model_vocab_size + 10)
            # Check that it actually resizes the embeddings matrix
            self.assertEqual(model_embed.weight.shape[0], cloned_embeddings.shape[0] + 10)
            # Check that the model can still do a forward pass successfully (every parameter should be resized)
>           model(**self._prepare_for_class(inputs_dict, model_class))

tests/test_modeling_common.py:655: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:891: in forward
    encoder_outputs = self.encoder(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:401: in forward
    hidden_states = layer_module(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:324: in forward
    attention_output = self.attention(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
src/transformers/modeling_deberta.py:257: in forward
    self_output = self.self(
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/torch/nn/modules/module.py:727: in _call_impl
    result = self.forward(*input, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = DisentangledSelfAttention(
  (in_proj): Linear(in_features=32, out_features=96, bias=False)
  (dropout): StableDropout()
)
hidden_states = tensor([[[ 0.0000, -1.3935,  1.0241,  ...,  0.4936,  0.0103,  0.0000],
         [-0.9223,  0.6012, -0.7819,  ..., -0.8...    [ 0.0000, -0.4612,  1.3087,  ...,  1.2537,  0.3499, -0.9116]]],
       device='cuda:0', grad_fn=<XDropoutBackward>)
attention_mask = tensor([[[[1, 1, 0, 0, 1, 1, 0],
          [1, 1, 0, 0, 1, 1, 0],
          [0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0,..., 0, 1, 0, 1],
          [0, 0, 0, 0, 0, 0, 0],
          [1, 0, 1, 0, 1, 0, 1]]]], device='cuda:0', dtype=torch.uint8)
return_att = False, query_states = None, relative_pos = None, rel_embeddings = None

    def forward(
        self,
        hidden_states,
        attention_mask,
        return_att=False,
        query_states=None,
        relative_pos=None,
        rel_embeddings=None,
    ):
        """Call the module
    
        Args:
            hidden_states (:obj:`torch.FloatTensor`):
                Input states to the module usally the output from previous layer, it will be the Q,K and V in `Attention(Q,K,V)`
    
            attention_mask (:obj:`torch.ByteTensor`):
                An attention mask matrix of shape [`B`, `N`, `N`] where `B` is the batch size, `N` is the maxium sequence length in which element [i,j] = `1` means the `i` th token in the input can attend to the `j` th token.                                                                                                   
    
            return_att (:obj:`bool`, optional):
                Whether return the attention maxitrix.
    
            query_states (:obj:`torch.FloatTensor`, optional):
                The `Q` state in `Attention(Q,K,V)`.
    
            relative_pos (:obj:`torch.LongTensor`):
                The relative position encoding between the tokens in the sequence. It's of shape [`B`, `N`, `N`] with values ranging in [`-max_relative_positions`, `max_relative_positions`].                                                                                                                                      
    
            rel_embeddings (:obj:`torch.FloatTensor`):
                The embedding of relative distances. It's a tensor of shape [:math:`2 \\times \\text{max_relative_positions}`, `hidden_size`].
    
    
        """
        if query_states is None:
            qp = self.in_proj(hidden_states)  # .split(self.all_head_size, dim=-1)
            query_layer, key_layer, value_layer = self.transpose_for_scores(qp).chunk(3, dim=-1)
        else:
    
            def linear(w, b, x):
                if b is not None:
                    return torch.matmul(x, w.t()) + b.t()
                else:
                    return torch.matmul(x, w.t())  # + b.t()
    
            ws = self.in_proj.weight.chunk(self.num_attention_heads * 3, dim=0)
            qkvw = [torch.cat([ws[i * 3 + k] for i in range(self.num_attention_heads)], dim=0) for k in range(3)]
            qkvb = [None] * 3
    
            q = linear(qkvw[0], qkvb[0], query_states)
            k, v = [linear(qkvw[i], qkvb[i], hidden_states) for i in range(1, 3)]
            query_layer, key_layer, value_layer = [self.transpose_for_scores(x) for x in [q, k, v]]
    
        query_layer += self.transpose_for_scores(self.q_bias[None, None, :])
>       value_layer += self.transpose_for_scores(self.v_bias[None, None, :])
E       RuntimeError: diff_view_meta->output_nr_ == 0 INTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1602659340682/work/torch/csrc/autograd/variable.cpp":352, please report a bug to PyTorch.

src/transformers/modeling_deberta.py:575: RuntimeError
======================================================================== warnings summary ========================================================================
/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/comet_ml/utils.py:30
  /home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/comet_ml/utils.py:30: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    from collections import Mapping, defaultdict

/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/comet_ml/monkey_patching.py:19
  /home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/comet_ml/monkey_patching.py:19: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/graphql/type/directives.py:55
  /home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/graphql/type/directives.py:55: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    assert isinstance(locations, collections.Iterable), 'Must provide locations for directive.'

/home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/graphql/type/typemap.py:1
  /home/stas/anaconda3/envs/main-38/lib/python3.8/site-packages/graphql/type/typemap.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    from collections import OrderedDict, Sequence, defaultdict

tests/test_modeling_deberta.py::DebertaModelTest::test_deberta_model
tests/test_modeling_deberta.py::DebertaModelTest::test_feed_forward_chunking
tests/test_modeling_deberta.py::DebertaModelTest::test_for_sequence_classification
tests/test_modeling_deberta.py::DebertaModelTest::test_resize_tokens_embeddings
  /mnt/nvme1/code/huggingface/transformers-master/src/transformers/modeling_deberta.py:574: UserWarning: Output 0 of SplitBackward is a view and is being modified inplace. This view is an output of a function that returns multiple views. Inplace operators on such views are being deprecated and will be forbidden starting from version 1.8. Consider using `unsafe_` version of the function that produced this view or don't modify this view inplace. (Triggered internally at  /opt/conda/conda-bld/pytorch_1602659340682/work/torch/csrc/autograd/variable.cpp:480.)
    query_layer += self.transpose_for_scores(self.q_bias[None, None, :])

tests/test_modeling_deberta.py::DebertaModelTest::test_deberta_model
tests/test_modeling_deberta.py::DebertaModelTest::test_feed_forward_chunking
tests/test_modeling_deberta.py::DebertaModelTest::test_for_sequence_classification
tests/test_modeling_deberta.py::DebertaModelTest::test_resize_tokens_embeddings
  /mnt/nvme1/code/huggingface/transformers-master/src/transformers/modeling_deberta.py:575: UserWarning: Output 2 of SplitBackward is a view and is being modified inplace. This view is an output of a function that returns multiple views. Inplace operators on such views are being deprecated and will be forbidden starting from version 1.8. Consider using `unsafe_` version of the function that produced this view or don't modify this view inplace. (Triggered internally at  /opt/conda/conda-bld/pytorch_1602659340682/work/torch/csrc/autograd/variable.cpp:480.)
    value_layer += self.transpose_for_scores(self.v_bias[None, None, :])

tests/test_modeling_deberta.py::DebertaModelTest::test_model_outputs_equivalence
  /mnt/nvme1/code/huggingface/transformers-master/src/transformers/modeling_deberta.py:1011: UserWarning: This overload of nonzero is deprecated:
        nonzero()
  Consider using one of the following signatures instead:
        nonzero(*, bool as_tuple) (Triggered internally at  /opt/conda/conda-bld/pytorch_1602659340682/work/torch/csrc/utils/python_arg_parser.cpp:945.)
    label_index = (labels >= 0).nonzero()

-- Docs: https://docs.pytest.org/en/stable/warnings.html
==================================================================== short test summary info =====================================================================
FAILED tests/test_modeling_deberta.py::DebertaModelTest::test_deberta_model - RuntimeError: diff_view_meta->output_nr_ == 0 INTERNAL ASSERT FAILED at "/opt/con...
FAILED tests/test_modeling_deberta.py::DebertaModelTest::test_feed_forward_chunking - RuntimeError: diff_view_meta->output_nr_ == 0 INTERNAL ASSERT FAILED at "...
FAILED tests/test_modeling_deberta.py::DebertaModelTest::test_for_sequence_classification - RuntimeError: diff_view_meta->output_nr_ == 0 INTERNAL ASSERT FAILE...
FAILED tests/test_modeling_deberta.py::DebertaModelTest::test_resize_tokens_embeddings - RuntimeError: diff_view_meta->output_nr_ == 0 INTERNAL ASSERT FAILED a...
====================================================== 4 failed, 22 passed, 7 skipped, 13 warnings in 7.85s ====================================================
```

Thank you!

## Environment info

```
- `transformers` version: master
- Platform: Linux-4.15.0-118-generic-x86_64-with-glibc2.10
- Python version: 3.8.5
- PyTorch version (GPU?): 1.8.0.dev20201014 (True)
- Tensorflow version (GPU?): 2.3.1 (True)
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>
```

@sgugger, @LysandreJik 

Comments:
Good to know that this we need to update this code for version 1.8.0. Thanks!

Ah, right, I didn't notice that it was nightly specific - if I'm not mistaken this is really for 1.7 I think - it's hard to tell though.

Ah, possible! I will take a look :)

Was fixed in https://github.com/huggingface/transformers/pull/8057