File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -3248,14 +3248,11 @@ static struct ggml_cgraph * llm_build_llama(
3248
3248
} else {
3249
3249
run_layer = NULL ;
3250
3250
}
3251
- } else if (ggml_allocr_is_measure (lctx.alloc ) && il == n_layer - 1 ) {
3252
- // No idea why this is needed, but otherwise we run out of space
3253
- // when skipping attn or mlp (but not both) on the last layer
3254
- run_mlp = false ;
3255
- } else if (ggml_allocr_is_measure (lctx.alloc ) && il == n_layer - 2 ) {
3256
- // No idea why this is needed, but otherwise we run out of space
3257
- // when skipping attn or mlp (but not both) on the last layer
3258
- run_attn = false ;
3251
+ } else if (ggml_allocr_is_measure (lctx.alloc )) {
3252
+ if (il == 0 || il == n_layer - 1 ) run_mlp = false ;
3253
+ else if (il == 1 || il == n_layer - 2 ) run_attn = false ;
3254
+ else if (il & 1 ) run_mlp = false ;
3255
+ else run_attn = false ;
3259
3256
}
3260
3257
if (!run_attn && !run_mlp) continue ;
3261
3258
You can’t perform that action at this time.
0 commit comments