From: Georgi Gerganov Date: Sat, 31 Dec 2022 10:29:30 +0000 (+0200) Subject: gpt-2 : fix off-by-one error in batching logic X-Git-Tag: upstream/0.0.1642~1601 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=99f1afb6139eb891b328b0a7fc4daa39d70dbb26;p=pkg%2Fggml%2Fsources%2Fggml gpt-2 : fix off-by-one error in batching logic --- diff --git a/examples/gpt-2/main.cpp b/examples/gpt-2/main.cpp index 8a35af51..333d93b8 100644 --- a/examples/gpt-2/main.cpp +++ b/examples/gpt-2/main.cpp @@ -756,7 +756,7 @@ int main(int argc, char ** argv) { // if here, it means we are still processing the input prompt for (int k = i; k < embd_inp.size(); k++) { embd.push_back(embd_inp[k]); - if (embd.size() > params.n_batch) { + if (embd.size() >= params.n_batch) { break; } }