the_coder:

It does not recognise x3, x4 and x5 from the ensemble class. My question is with the following code:
outputs = model(input_ids, attention_mask)
is it considering input_ids as x1 and attention_mask as x2 and cannot recognise x3,x4 and x5 ?


I believe that’s correct. According to your forward function for your ensemble, it requires 5 inputs:



 the_coder:

def forward(self, x1, x2,x3,x4,x5):


and you are only passing in 2.



 the_coder:

I could not fully understand the following code in the MyEnsemble() class. Could you please explain if i am correct on this one?
self.classifier = torch.nn.Linear(768, 6)



It is a linear layer with 768 inputs and 6 outputs. I’m assuming you are doing some text classification with 6 possible categories. It’s mapping the BERT output representation (which look like it is 768 dimensional) to 1 of 6 categories.