Crystalcareai
commited on
Commit
•
37c4611
1
Parent(s):
6f8d262
Update modeling_quiet.py
Browse files- modeling_quiet.py +2 -4
modeling_quiet.py
CHANGED
@@ -158,15 +158,13 @@ def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1):
|
|
158 |
Returns:
|
159 |
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
160 |
"""
|
161 |
-
|
162 |
-
|
163 |
-
sin = sin[position_ids, :, :seq_len, :]
|
164 |
q_embed = (q * cos) + (rotate_half(q) * sin)
|
165 |
k_embed = (k * cos) + (rotate_half(k) * sin)
|
166 |
return q_embed, k_embed
|
167 |
|
168 |
|
169 |
-
|
170 |
class QuietMLP(nn.Module):
|
171 |
def __init__(self, config):
|
172 |
super().__init__()
|
|
|
158 |
Returns:
|
159 |
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
160 |
"""
|
161 |
+
cos = cos[position_ids].unsqueeze(unsqueeze_dim)
|
162 |
+
sin = sin[position_ids].unsqueeze(unsqueeze_dim)
|
|
|
163 |
q_embed = (q * cos) + (rotate_half(q) * sin)
|
164 |
k_embed = (k * cos) + (rotate_half(k) * sin)
|
165 |
return q_embed, k_embed
|
166 |
|
167 |
|
|
|
168 |
class QuietMLP(nn.Module):
|
169 |
def __init__(self, config):
|
170 |
super().__init__()
|