print error on insufficient batch size

This commit is contained in:
Minsoo Cheong 2024-03-23 14:33:03 +09:00
parent 208e1f03c3
commit 789a194da1

View file

@ -171,7 +171,9 @@ int main(int argc, char ** argv) {
for (auto & chunk : chunks) { for (auto & chunk : chunks) {
auto inp = ::llama_tokenize(ctx, chunk.textdata, true, false); auto inp = ::llama_tokenize(ctx, chunk.textdata, true, false);
if (inp.size() > n_batch) { if (inp.size() > n_batch) {
inp.resize(n_batch); // error: chunk size exceeds batch size
fprintf(stderr, "%s: error: chunk size (%zu) exceeds batch size (%zu), increase batch size and re-run\n",__func__, inp.size(), n_batch);
return 1;
} }
// add eos if not present // add eos if not present
if (inp.empty() || inp.back() != llama_token_eos(model)) { if (inp.empty() || inp.back() != llama_token_eos(model)) {