Skip to content

Commit a616605

Browse files
committed
ggml : require mask when using ALiBi
ggml-ci
1 parent 397b1f8 commit a616605

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ggml.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5657,6 +5657,10 @@ static struct ggml_tensor * ggml_soft_max_impl(
56575657
GGML_ASSERT(mask->ne[1] >= a->ne[1]);
56585658
}
56595659

5660+
if (max_bias > 0.0f) {
5661+
GGML_ASSERT(mask);
5662+
}
5663+
56605664
bool is_node = false;
56615665

56625666
if (a->grad) {
@@ -6440,6 +6444,7 @@ struct ggml_tensor * ggml_flash_attn_ext(
64406444
float max_bias) {
64416445
GGML_ASSERT(ggml_can_mul_mat(k, q));
64426446
// TODO: check if vT can be multiplied by (k*qT)
6447+
64436448
if (mask) {
64446449
GGML_ASSERT(ggml_is_contiguous(mask));
64456450
GGML_ASSERT(mask->ne[2] == 1);
@@ -6449,6 +6454,10 @@ struct ggml_tensor * ggml_flash_attn_ext(
64496454
//GGML_ASSERT(ggml_can_repeat_rows(mask, qk));
64506455
}
64516456

6457+
if (max_bias > 0.0f) {
6458+
GGML_ASSERT(mask);
6459+
}
6460+
64526461
bool is_node = false;
64536462

64546463
if (q->grad || k->grad || v->grad) {

0 commit comments

Comments
 (0)