From 99f1afb6139eb891b328b0a7fc4daa39d70dbb26 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 31 Dec 2022 12:29:30 +0200 Subject: [PATCH] gpt-2 : fix off-by-one error in batching logic --- examples/gpt-2/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gpt-2/main.cpp b/examples/gpt-2/main.cpp index 8a35af5..333d93b 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; } }