Spaces:
Running
on
Zero
Running
on
Zero
v1
Browse files
meteor/arch/modeling_internlm2.py
CHANGED
@@ -277,6 +277,9 @@ def rotate_half(x):
|
|
277 |
# Copied from transformers.model.llama.modeling_llama.apply_rotary_pos_emb
|
278 |
def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1):
|
279 |
"""Applies Rotary Position Embedding to the query and key tensors."""
|
|
|
|
|
|
|
280 |
cos = cos[position_ids].unsqueeze(unsqueeze_dim)
|
281 |
sin = sin[position_ids].unsqueeze(unsqueeze_dim)
|
282 |
q_embed = (q * cos) + (rotate_half(q) * sin)
|
|
|
277 |
# Copied from transformers.model.llama.modeling_llama.apply_rotary_pos_emb
|
278 |
def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1):
|
279 |
"""Applies Rotary Position Embedding to the query and key tensors."""
|
280 |
+
print(f'------------------------------cos: {cos.device}------------------------------')
|
281 |
+
print(f'------------------------------position_ids: {position_ids.device}------------------------------')
|
282 |
+
print(f'------------------------------unsqueeze_dim: {unsqueeze_dim.device}------------------------------')
|
283 |
cos = cos[position_ids].unsqueeze(unsqueeze_dim)
|
284 |
sin = sin[position_ids].unsqueeze(unsqueeze_dim)
|
285 |
q_embed = (q * cos) + (rotate_half(q) * sin)
|