prateekjoshi565 / Fine-Tuning-BERT

Apache License 2.0
139 stars 119 forks source link

linear(): argument 'input' (position 1) must be Tensor, not str #10

Open chrischang5 opened 3 years ago

chrischang5 commented 3 years ago

image

Tried running the code but got this error on both my dataset and the example dataset.

swarupe commented 3 years ago

Hi @chrischang5 Even I am facing the same issue. Were you able to fix it?

chrischang5 commented 3 years ago

Hi @swarupe, unfortunately, I was not able to fix it. I've seen talks on using older versions of Huggingface transformers but I haven't been able to test them fully.

teejay13 commented 3 years ago

getting exact error output Any Solution

claudio-toledo commented 3 years ago

Same error. I was able to get it resolved to downgrade Transformers: pip install transformers==3

alankar66 commented 3 years ago

In the BERT_Arch(nn.Module): class change the line

from: _, cls_hs = self.bert(sent_id, attention_mask=mask)

to this:- _, cls_hs = self.bert(sent_id, attention_mask=mask, return_dict=False)

mukherjeekoushiklearning commented 1 year ago

Thank you so much for this solution. I was really struggling to solve this issue.