fix?
This commit is contained in:
parent
b4227f7732
commit
e4cdb95c3d
2
gpt2.py
2
gpt2.py
@ -68,7 +68,7 @@ class GPT2ClassificationHeadCustom(nn.Module):
|
|||||||
def forward(self, x, **kwargs):
|
def forward(self, x, **kwargs):
|
||||||
if 'hidden_states' in kwargs and kwargs['hidden_states'] is not None:
|
if 'hidden_states' in kwargs and kwargs['hidden_states'] is not None:
|
||||||
# Get last 5 hidden states from the end
|
# Get last 5 hidden states from the end
|
||||||
hidden = torch.cat(kwargs['hidden_states'][-5:], dim=2)
|
hidden = torch.cat(kwargs['hidden_states'][-5:])
|
||||||
else:
|
else:
|
||||||
hidden = torch.zeros(x.size(), dtype=x.dtype, device=x.device)
|
hidden = torch.zeros(x.size(), dtype=x.dtype, device=x.device)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user