Use BERT to compute sentence similaritySee original GitHub issue
I want to compute similarity between two sentences (
sentA and sentB).
I have encoded each sentence using script i.e. load_and_extract.py. so now embedding matrix of
sentB has shape
(1,512,768). After that i am thinking to add fully connected layer to compute the similarity between two sentences.
Note: I am using base model (with 12 hidden layers)
Question: Is this right approach to use BERT for sentence similarity? Furthermore, I have also seen some people are using
MaskedGlobalMaxPool1D after hidden layers to encode the sentences. Do I have to take embeddings after applying
MaskedGlobalMaxPool1D? Why there is need of
Thanks in advance.
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
I know bert-as-a-service and I’ve asked how to encode works: https://github.com/hanxiao/bert-as-service/issues/384
I would like to know how to extract the ‘sentence embeddings’ myself. I’ll check the ELMo like embeddings as well. Thanks.