ThingsAI commited on
Commit
85e1731
·
verified ·
1 Parent(s): 5c0671e

fix: v.to(q.dtype) prima di SDPA

Browse files
Files changed (1) hide show
  1. modeling_quark.py +1 -0
modeling_quark.py CHANGED
@@ -77,6 +77,7 @@ class GroupedQueryAttention(nn.Module):
77
  if self.n_groups > 1:
78
  k = k.repeat_interleave(self.n_groups, dim=1)
79
  v = v.repeat_interleave(self.n_groups, dim=1)
 
80
  out = F.scaled_dot_product_attention(
81
  q, k, v, attn_mask=None,
82
  dropout_p=self.drop if self.training else 0.0,
 
77
  if self.n_groups > 1:
78
  k = k.repeat_interleave(self.n_groups, dim=1)
79
  v = v.repeat_interleave(self.n_groups, dim=1)
80
+ v = v.to(q.dtype) # allinea dtype dopo RoPE (cos/sin sono float32)
81
  out = F.scaled_dot_product_attention(
82
  q, k, v, attn_mask=None,
83
  dropout_p=self.drop if self.training else 0.0,