WIP examples
This commit is contained in:
@@ -393,7 +393,7 @@ class XLNetRelativeAttention(nn.Module):
|
||||
x = x[1:, ...]
|
||||
x = x.reshape(x_size[0], x_size[1] - 1, x_size[2], x_size[3])
|
||||
# x = x[:, 0:klen, :, :]
|
||||
x = torch.index_select(x, 1, torch.arange(klen))
|
||||
x = torch.index_select(x, 1, torch.arange(klen, device=x.device, dtype=torch.long))
|
||||
|
||||
return x
|
||||
|
||||
|
||||
@@ -227,6 +227,8 @@ class BertAdam(Optimizer):
|
||||
lr = []
|
||||
for group in self.param_groups:
|
||||
for p in group['params']:
|
||||
if p.grad is None:
|
||||
continue
|
||||
state = self.state[p]
|
||||
if len(state) == 0:
|
||||
return [0]
|
||||
|
||||
Reference in New Issue
Block a user