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:
1 parent
2639a3b4e0
commit
1ddc262558
1 file changed
+4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user