Skip to content

TypeError: new() received an invalid combination of arguments - got (NoneType, int), but expected one of: * (*, torch.device device) #12

@alwayslikethat

Description

@alwayslikethat

Traceback (most recent call last):
File "D:/pythonProject/bert-event-extraction-master/train.py", line 80, in
model = Net(
File "D:\pythonProject\bert-event-extraction-master\model.py", line 18, in init
self.entity_embed = MultiLabelEmbeddingLayer(num_embeddings=entity_size, embedding_dim=entity_embedding_dim, device=device)
File "D:\pythonProject\bert-event-extraction-master\model.py", line 129, in init
self.matrix = nn.Embedding(num_embeddings=num_embeddings,
File "D:\anaconda2020\lib\site-packages\torch\nn\modules\sparse.py", line 109, in init
self.weight = Parameter(torch.Tensor(num_embeddings, embedding_dim))
TypeError: new() received an invalid combination of arguments - got (NoneType, int), but expected one of:

  • (*, torch.device device)
    didn't match because some of the arguments have invalid types: (!NoneType!, !int!)
  • (torch.Storage storage)
  • (Tensor other)
  • (tuple of ints size, *, torch.device device)
  • (object data, *, torch.device device)

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