Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where is the positional embedding in the Bert model inputs #32

Open
chenyez opened this issue Nov 13, 2019 · 0 comments
Open

where is the positional embedding in the Bert model inputs #32

chenyez opened this issue Nov 13, 2019 · 0 comments

Comments

@chenyez
Copy link

chenyez commented Nov 13, 2019

First thanks for sharing the code, it's really helpful!!

I have a question when I tried to use the pretrained Bert on my dataset for sentence classification. I realize that in Bert, the input feature should be consist of token embedding, segment embedding and position embedding. But I'm not seeing the positional embedding in your code. In run_model:

        inputs = {'input_ids':      batch[0],
                  'attention_mask': batch[1],
                  'token_type_ids': batch[2] if args['model_type'] in ['bert', 'xlnet'] else None,  # XLM don't use segment_ids
                  'labels':         batch[3]}
        outputs = model(**inputs)

Or I might miss this detail, could you please tell me whether you implement this, and if so where exactly?

Thanks again and looking forward to your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant