Open junwenxiong opened 2 months ago
Hi, sorry for the late reply. This error is caused by the position of qknorm layer. We use the class PhiSdpaAttention(PhiAttention)
and we will update the corresponding code of class PhiAttention
in phi.py
.
You can directly use the code below to change the position of qk norm.
query_states = self.q_proj(hidden_states)
key_states = self.k_proj(hidden_states)
value_states = self.v_proj(hidden_states)
#if self.qk_layernorm:
# query_states = self.q_layernorm(query_states)
# key_states = self.k_layernorm(key_states)
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
# use the qknorm here
if self.qk_layernorm:
query_states = self.q_layernorm(query_states)
key_states = self.k_layernorm(key_states)
An error occurs when inference is performed using the default configuration, and it seems to be a problem with the dimension of the features. Is there any solution for this?