Skip to content

Commit 79b2b26

Browse files
committed
If n_predict == -1, generate forever
1 parent e2d490d commit 79b2b26

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

examples/chat.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ cd ..
1111
#
1212
# "--keep 48" is based on the contents of prompts/chat-with-bob.txt
1313
#
14-
./main -m ./models/7B/ggml-model-q4_0.bin -c 2048 -b 1024 -n 256 --keep 48 \
14+
./main -m ./models/7B/ggml-model-q4_0.bin -c 512 -b 1024 -n 256 --keep 48 \
1515
--repeat_penalty 1.0 --color -i \
1616
-r "User:" -f prompts/chat-with-bob.txt

examples/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
204204
fprintf(stderr, " --in-prefix STRING string to prefix user inputs with (default: empty)\n");
205205
fprintf(stderr, " -f FNAME, --file FNAME\n");
206206
fprintf(stderr, " prompt file to start generation.\n");
207-
fprintf(stderr, " -n N, --n_predict N number of tokens to predict (default: %d)\n", params.n_predict);
207+
fprintf(stderr, " -n N, --n_predict N number of tokens to predict (default: %d, -1 - infinity)\n", params.n_predict);
208208
fprintf(stderr, " --top_k N top-k sampling (default: %d)\n", params.top_k);
209209
fprintf(stderr, " --top_p N top-p sampling (default: %.1f)\n", params.top_p);
210210
fprintf(stderr, " --repeat_last_n N last n tokens to consider for penalize (default: %d)\n", params.repeat_last_n);

examples/main/main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ int main(int argc, char ** argv) {
199199
}
200200

201201
params.n_keep = std::min(params.n_keep, (int) embd_inp.size());
202-
//params.n_predict = std::min(params.n_predict, n_ctx - (int) embd_inp.size());
203202

204203
// prefix & suffix for instruct mode
205204
const auto inp_pfx = ::llama_tokenize(ctx, "\n\n### Instruction:\n\n", true);
@@ -293,7 +292,7 @@ int main(int argc, char ** argv) {
293292

294293
std::vector<llama_token> embd;
295294

296-
while (n_remain > 0 || params.interactive) {
295+
while (n_remain != 0 || params.interactive) {
297296
// predict
298297
if (embd.size() > 0) {
299298
// infinite text generation via context swapping

0 commit comments

Comments
 (0)