From: Georgi Gerganov Date: Thu, 24 Apr 2025 19:29:22 +0000 (+0300) Subject: embeddings : fix batch sizes (#13076) X-Git-Tag: upstream/0.0.5185^0 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=226251ed56b85190e18a1cca963c45b888f4953c;p=pkg%2Fggml%2Fsources%2Fllama.cpp embeddings : fix batch sizes (#13076) ggml-ci --- diff --git a/examples/embedding/embedding.cpp b/examples/embedding/embedding.cpp index 6f089041..06fce236 100644 --- a/examples/embedding/embedding.cpp +++ b/examples/embedding/embedding.cpp @@ -89,6 +89,13 @@ int main(int argc, char ** argv) { common_init(); params.embedding = true; + + // utilize the full context + if (params.n_batch < params.n_ctx) { + LOG_WRN("%s: setting batch size to %d\n", __func__, params.n_ctx); + params.n_batch = params.n_ctx; + } + // For non-causal models, batch size must be equal to ubatch size params.n_ubatch = params.n_batch; @@ -134,7 +141,6 @@ int main(int argc, char ** argv) { // max batch size const uint64_t n_batch = params.n_batch; - GGML_ASSERT(params.n_batch >= params.n_ctx); // tokenize the prompts and trim std::vector> inputs;