]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
gpt-2 : fix off-by-one error in batching logic
authorGeorgi Gerganov <redacted>
Sat, 31 Dec 2022 10:29:30 +0000 (12:29 +0200)
committerGeorgi Gerganov <redacted>
Sat, 31 Dec 2022 10:29:30 +0000 (12:29 +0200)
examples/gpt-2/main.cpp

index 8a35af5189c07ac713f61e3d02119d98f59dadd2..333d93b8b5e62cc6da13379eb7ba1502bb2f429c 100644 (file)
@@ -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;
                 }
             }