Seq2Seq Model with PreTrained BERT Model is Throwing Error During Training: ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
Hi,

I tried creating a seq2seq model using pretrained BERT model following your tutorials:
https://github.com/bentrevett/pytorch-sentiment-analysis/blob/master/6%20-%20Transformers%20for%20Sentiment%20Analysis.ipynb

https://github.com/bentrevett/pytorch-seq2seq/blob/master/1%20-%20Sequence%20to%20Sequence%20Learning%20with%20Neural%20Networks.ipynb

However during training, I am getting the following error:
```
AttributeError                            Traceback (most recent call last)

<ipython-input-63-472071541d41> in <module>()
      8     start_time = time.time()
      9 
---> 10     train_loss = train(model, train_iterator, optimizer, criterion, CLIP)
     11     valid_loss = evaluate(model, valid_iterator, criterion)
     12 

6 frames

/usr/local/lib/python3.7/dist-packages/transformers/models/bert/modeling_bert.py in forward(self, input_ids, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, encoder_hidden_states, encoder_attention_mask, past_key_values, use_cache, output_attentions, output_hidden_states, return_dict)
    917             raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
    918         elif input_ids is not None:
--> 919             input_shape = input_ids.size()
    920             batch_size, seq_length = input_shape
    921         elif inputs_embeds is not None:

AttributeError: 'Field' object has no attribute 'size'
```
I am sharing my code for your review in the following github repo:
https://github.com/Ninja16180/BERT/blob/main/Training_Seq2Seq_Model_using_Pre-Trained_BERT_Model.ipynb

Also, request you to kindly review the Encoder and Decoder classes which have been modified to incorporate pretrained bert embedding.

Thanks in advance!
Hi @Ninja16180 

Could you please post a short code snippet to reproduce the issue? Thanks.<|||||>Hi Suraj,

I was able to find out the issue; there was a variable name I wrongly passed into the decoder class and hence the error.

Correction made:
`embedded = self.bert(sent2)[0] should be embedded = self.bert(input)[0] `

Thus closing this issue.