Skip to content

Commit 4ef777c

Browse files
Remove redundant if conditions
1 parent 3dd3474 commit 4ef777c

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/main/java/org/beehive/gpullama3/inference/InferenceCore.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,10 @@ public static FloatTensor forwardJavaQwen2(Model model, State state, int token,
201201
weights.wk[l].matmul(state.xb, state.k, kvDim, dim);
202202
weights.wv[l].matmul(state.xb, state.v, kvDim, dim);
203203

204-
if ((weights.q_bias != null && weights.q_bias[curLayer] != null)
205-
|| (weights.k_bias != null && weights.k_bias[curLayer] != null)
206-
|| (weights.v_bias != null && weights.v_bias[curLayer] != null)) {
207-
if (weights.q_bias != null && weights.q_bias[curLayer] != null) {
208-
state.q.addInPlace(weights.q_bias[curLayer]);
209-
}
210-
if (weights.k_bias != null && weights.k_bias[curLayer] != null) {
211-
state.k.addInPlace(weights.k_bias[curLayer]);
212-
}
213-
if (weights.v_bias != null && weights.v_bias[curLayer] != null) {
214-
state.v.addInPlace(weights.v_bias[curLayer]);
215-
}
216-
}
204+
// qkv additions with qkv bias
205+
state.q.addInPlace(weights.q_bias[curLayer]);
206+
state.k.addInPlace(weights.k_bias[curLayer]);
207+
state.v.addInPlace(weights.v_bias[curLayer]);
217208

218209
// RoPE relative positional encoding: complex-valued rotate q and k in each head
219210
// GPT-NeoX style RoPE, real/imaginary components are stored with a headSize/2 offset per head, instead of consecutive.

0 commit comments

Comments
 (0)