The default setting is to use the bidirectional data, attn_type='bi', but bsz=1.
But in this function,
|
def relative_positional_encoding(self, qlen, klen, d_model, clamp_len, attn_type, |
It shows the bidirectional data only works when bsz%2 ==0. However in default, bsz = 1.
I am confused, if bsz=1, the setting for the beg, and end in the following code, is it right?
|
if attn_type == 'bi': |
|
# beg, end = klen - 1, -qlen |
|
beg, end = klen, -qlen |
|
elif attn_type == 'uni': |
|
# beg, end = klen - 1, -1 |
|
beg, end = klen, -1 |
|
else: |
|
raise ValueError('Unknown `attn_type` {}.'.format(attn_type)) |
Could anyone help me with this confusion?
The default setting is to use the bidirectional data, attn_type='bi', but bsz=1.
But in this function,
xlnet-Pytorch/xlnet.py
Line 371 in cb793a1
It shows the bidirectional data only works when bsz%2 ==0. However in default, bsz = 1.
I am confused, if bsz=1, the setting for the beg, and end in the following code, is it right?
xlnet-Pytorch/xlnet.py
Lines 380 to 387 in cb793a1
Could anyone help me with this confusion?