Skip to content

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

@basti97

Description

@basti97

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions