* embedding: assign `n_ubatch` value, print error on `n_batch` overflow
* Update examples/embedding/embedding.cpp
Co-authored-by: Xuan Son Nguyen <redacted>
* use %ld instead of %lld
* Revert "use %ld instead of %lld"
This reverts commit
ea753ede90a86a0699f65878cc8e2020ff5eabb8.
---------
Co-authored-by: Xuan Son Nguyen <redacted>
}
params.embedding = true;
+ // For non-causal models, batch size must be equal to ubatch size
+ params.n_ubatch = params.n_batch;
print_build_info();
for (const auto & prompt : prompts) {
auto inp = ::llama_tokenize(ctx, prompt, true, false);
if (inp.size() > n_batch) {
- inp.resize(n_batch);
+ fprintf(stderr, "%s: error: number of tokens in input line (%lld) exceeds batch size (%lld), increase batch size and re-run\n",
+ __func__, (long long int) inp.size(), (long long int) n_batch);
+ return 1;
}
inputs.push_back(inp);
}