Skip to content

Incorrect mask type in Seq2Seq encoder #68

@david-waterworth

Description

@david-waterworth

The seq2seq implementation of mean and max pooling crashes using allennlp 2.7 and pytorch 1,8

The issue is that both mean and max pooling mask the encoded output by converting the original mask from bool to float and multiplying. This masked tensor is then passed to masked_mean or masked_max along with the float mask, but masked_mean or masked_max require a bool mask, 'masked_max` fails on the first line

vector.masked_fill(~mask, min_value_of_dtype(vector.dtype))

It seems unnecessary in the first place to mask the embeddings since that's done in masked_mean or masked_max

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