Qwen
/

yangapku commited on
Commit
82b1a35
·
1 Parent(s): 9060502

fix cpu inference

Browse files
Files changed (1) hide show
  1. modeling_qwen.py +1 -1
modeling_qwen.py CHANGED
@@ -1177,7 +1177,7 @@ def _rotate_half(x):
1177
 
1178
 
1179
  def apply_rotary_pos_emb(t, freqs):
1180
- if apply_rotary_emb_func is not None:
1181
  t_ = t.float()
1182
  freqs = freqs.squeeze(0).squeeze(1)
1183
  cos = freqs[:, : freqs.shape[-1] // 2].cos()
 
1177
 
1178
 
1179
  def apply_rotary_pos_emb(t, freqs):
1180
+ if apply_rotary_emb_func is not None and t.is_cuda:
1181
  t_ = t.float()
1182
  freqs = freqs.squeeze(0).squeeze(1)
1183
  cos = freqs[:, : freqs.shape[-1] // 2].cos()