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

forward() got an unexpected keyword argument 'device' #19

Open
basti97 opened this issue Jun 11, 2021 · 1 comment
Open

forward() got an unexpected keyword argument 'device' #19

basti97 opened this issue Jun 11, 2021 · 1 comment

Comments

@basti97
Copy link

basti97 commented Jun 11, 2021

Hello,

thanks for sharing your code.
I am new to BERT and finetuning and I tried your code with costumn data.

I recieved following error on running DocumentBertMaxPool/DocumentBertLinear:

_` batch_predictions = self.bert_doc_classification(batch_document_tensors,
185 batch_document_sequence_lengths,
--> 186 freeze_bert=self.args['freeze_bert'], device=self.args['device'])
187
188 batch_correct_output = correct_output[i:i + self.args['batch_size']].to(device=self.args['device'])

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)

TypeError: forward() got an unexpected keyword argument 'device'_
`

I think the reason for this problem is that there is missing the 'freeze_bert'-argument in the forward-method of the model architecture (document_bert_architectures.py).

Thanks for response.

@zeinramadan
Copy link

I am getting a similar error with the forward function, did you manage to figure out what was the 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

2 participants