Marmik commited on
Commit
b3677cf
·
verified ·
1 Parent(s): 1ab66d9

Update modeling_tiny_mixtral.py

Browse files
Files changed (1) hide show
  1. modeling_tiny_mixtral.py +1 -0
modeling_tiny_mixtral.py CHANGED
@@ -179,6 +179,7 @@ def apply_rotary_embeddings(x:torch.Tensor,freq_complex:torch.Tensor,device:str)
179
  Returns:
180
  torch.Tensor: The tensor after applying Rotary Position Embeddings.
181
  """
 
182
  x_complex=torch.view_as_complex(x.float().reshape(*x.shape[:-1],-1,2)) #N,seq_len,h,head_dim/2,2
183
 
184
  freq_complex=freq_complex.unsqueeze(0).unsqueeze(2) # 1,seq_len,1,head_dim/2
 
179
  Returns:
180
  torch.Tensor: The tensor after applying Rotary Position Embeddings.
181
  """
182
+ freq_complex = freq_complex.to(x.device)
183
  x_complex=torch.view_as_complex(x.float().reshape(*x.shape[:-1],-1,2)) #N,seq_len,h,head_dim/2,2
184
 
185
  freq_complex=freq_complex.unsqueeze(0).unsqueeze(2) # 1,seq_len,1,head_dim/2