Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chrischang5 opened this issue Apr 3, 2021 · 6 comments
Open

Comments

@chrischang5
Copy link

image

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

@chrischang5 chrischang5 changed the title Incorrect input arg type linear(): argument 'input' (position 1) must be Tensor, not str Apr 3, 2021
@swarupe
Copy link

swarupe commented Apr 6, 2021

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

@chrischang5
Copy link
Author

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
Copy link

getting exact error output Any Solution

@claudio-toledo
Copy link

claudio-toledo commented Apr 28, 2021

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

@alankar66
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants