Skip to content

05_seminar: error - unexpected keyword argument 'input_ids' #130

@chistotinsa

Description

@chistotinsa

class MyBertBasedClassifier(nn.Module):
def init(self):
super().init()
self.bert = transformers.AutoModel.from_pretrained('bert-base-uncased')
self.head = nn.Linear(768, 2)

def forward(self, **kwargs):
  out = model(**tokens_info)['pooler_output']
  return self.head(out)

clf = MyBertBasedClassifier()
clf(**tokens_info)

'''the last string returns an error:
TypeError: _forward_unimplemented() got an unexpected keyword argument 'input_ids'

I double-checked an entire code and its equal to the code in the original seminar notebook. Cant understand whats wrong.'''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions