Closed zhiyuanpeng closed 1 year ago
Hi,
When I set
batch_size: 4 hard_negatives: 1 other_negatives: 1
The first batch returned by create_biencoder_input:
create_biencoder_input
positive_ctx_indices [0, 3, 6, 9] hard_neg_ctx_indices [[1], [4], [7], [10]]
while from this line, hard_neg_ctx_indices should be [[2], [5], [8], [11]] and [[1], [4], [7], [10]] should be the index of neg_ctxs
[[2], [5], [8], [11]]
[[1], [4], [7], [10]]
neg_ctxs
all_ctxs = [positive_ctx] + neg_ctxs + hard_neg_ctxs
The reason why this happens is that hard_neg_ctx_indices starts directly from the index of query instead of neg_ctxs:
hard_neg_ctx_indices
hard_neg_ctx_indices.append( [ i for i in range( current_ctxs_len + hard_negatives_start_idx, current_ctxs_len + hard_negatives_end_idx, ) ] )
Is this a bug? Thanks.
find answers in other issues
Hi,
When I set
The first batch returned by
create_biencoder_input
:while from this line, hard_neg_ctx_indices should be
[[2], [5], [8], [11]]
and[[1], [4], [7], [10]]
should be the index ofneg_ctxs
The reason why this happens is that
hard_neg_ctx_indices
starts directly from the index of query instead ofneg_ctxs
:Is this a bug? Thanks.