graph: keep the graph non empty without embeddings (#30522)

An embedding-only graph has no logits, and build_pooling() returns
early when embeddings are off, so since the models no longer expand
t_embd the graph ends up empty and its inputs are never allocated.
Expand t_embd in that case.
This commit is contained in:
Pascal authored and GitHub committed 2026-10-15 06:38:12 +02:00
1 parent 2639a3b4e0
commit 1ddc262558
1 file changed
+4
+4
View File
@@ -3978,6 +3978,10 @@ void llm_graph_context::build_pooling(
ggml_tensor * cls_out_b,
ggml_tensor * cls_norm) const {
if (!cparams.embeddings) {
// a graph without logits still computes t_embd, so that it is never empty
if (res->t_logits == nullptr && res->t_embd != nullptr) {
ggml_build_forward_expand(gf, res->t_embd);
}
return;
}