Hi I want to use BERT for pairwise loss function. I know how to use it using pointwise loss using the run_classiifer where I can pass query as text_a and passage as a text_b.
But for pairwise loss, I have a triplet like [query, positive_passage, negative_passage]. So I want BERT to give me like this pos_score = modeling.BertModel(query, positive_passage) and neg_score= modeling.BertModel(query, negative_passage). Then apply Dense layer on the Difference of pos_score and neg_score and SoftMax like in run_classifier.
Note that I want the same modeling.BertModel for both positive and negative passage not two sepearte modeling.BertModel. In another word, positive passage and negative passage share the same BERT layer. Please let me know how to do it.
You can take a look at this Keras code to get the idea of what I am talking about https://github.com/airalcorn2/RankNet/blob/master/ranknet.py
6条答案
按热度按时间cczfrluj1#
Mark。同样的问题。
u7up0aaq2#
Mark。同样的问题。
eanckbw93#
问题是否已解决?
k7fdbhmy4#
mark
ih99xse15#
mark
3ks5zfa06#
mark mark