Crystalcareai commited on
Commit
ac546a8
1 Parent(s): 75df32a

Update modeling_gemmoe.py

Browse files
Files changed (1) hide show
  1. modeling_gemmoe.py +2 -2
modeling_gemmoe.py CHANGED
@@ -746,7 +746,7 @@ class GemmoeDecoderLayer(nn.Module):
746
 
747
  # Check if the tensor sizes match before adding residual
748
  if hidden_states.size() != residual.size():
749
- hidden_states = hidden_states.view(residual.size())
750
 
751
  hidden_states = residual + hidden_states
752
 
@@ -757,7 +757,7 @@ class GemmoeDecoderLayer(nn.Module):
757
 
758
  # Check if the tensor sizes match before adding residual
759
  if hidden_states.size() != residual.size():
760
- hidden_states = hidden_states.view(residual.size())
761
 
762
  hidden_states = residual + hidden_states
763
 
 
746
 
747
  # Check if the tensor sizes match before adding residual
748
  if hidden_states.size() != residual.size():
749
+ hidden_states = hidden_states[:, -residual.size(1):, :]
750
 
751
  hidden_states = residual + hidden_states
752
 
 
757
 
758
  # Check if the tensor sizes match before adding residual
759
  if hidden_states.size() != residual.size():
760
+ hidden_states = hidden_states[:, -residual.size(1):, :]
761
 
762
  hidden_states = residual + hidden_states
763