Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

BagOfWordCountsTokenEmbedder & BasicClassifier not compatible #3388

Open
camelop opened this issue Oct 22, 2019 · 18 comments
Open

BagOfWordCountsTokenEmbedder & BasicClassifier not compatible #3388

camelop opened this issue Oct 22, 2019 · 18 comments

Comments

@camelop
Copy link

camelop commented Oct 22, 2019

Bug Description
BagOfWordCountsTokenEmbedder returns tensor with shape [batchsize, size of vocab (or projection dim)], while most of other embedders return [batchsize, num of tokens, size of hidden]
This is at some level inconsistent with the definition of embedder, so seq2vec in BasicClassifier cannot be applied (the input is not even a sequence).

To Reproduce
Use them together like

"model": {
        "type": "basic_classifier",
        "text_field_embedder": {
            "token_embedders": {
                "tokens": {
                    "type": "bag_of_word_counts"
                }
            }
        },
        "seq2vec_encoder": ... # any
    },

Expected behavior
At least make the output of BagOfWordCountsTokenEmbedder looks like [bs, 1, vocab size] would help. (Although it will still be a bit confusing.)

System (please complete the following information):

  • OS: any (ubuntu 16.04)
  • Python version: 3.7
  • AllenNLP version: v0.9.0
  • PyTorch version: 1.3.0
@brendan-ai2
Copy link
Contributor

@kernelmachine , could you take a look at this? (As it looks like you're the author of the BagOfWordCountsTokenEmbedder.) @camelop's point seems like a good one, but I'm not sure what implications there are for existing code. Thanks!

@matt-gardner
Copy link
Contributor

ping @kernelmachine

@kernelmachine
Copy link
Contributor

Yes, I think unsqueezing the num_tokens dimension is a reasonable solution (it is a bit confusing, but we could make it clear in the documentation). The bag of words embedder is pretty isolated from the rest of the repo, so I don't think it'll be an issue. Contributions would be welcome!

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

14 similar comments
@github-actions
Copy link

github-actions bot commented Sep 2, 2020

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

github-actions bot commented Jan 7, 2021

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

github-actions bot commented Feb 5, 2021

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@github-actions
Copy link

github-actions bot commented Mar 5, 2021

@kernelmachine this is just a friendly ping to make sure you haven't forgotten about this issue 😜

@kernelmachine kernelmachine removed their assignment Mar 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants