Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add retrieval example #6193

Merged
merged 21 commits into from
Mar 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
print error on insufficient batch size
  • Loading branch information
mscheong01 committed Mar 23, 2024
commit 789a194da14314fd12cd5fe9b9c4e9f4f28850a8
4 changes: 3 additions & 1 deletion examples/retrieval/retrieval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ int main(int argc, char ** argv) {
for (auto & chunk : chunks) {
auto inp = ::llama_tokenize(ctx, chunk.textdata, true, false);
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
if (inp.empty() || inp.back() != llama_token_eos(model)) {
Expand Down
Loading