mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-30 08:42:00 +00:00 
			
		
		
		
	If n_predict == -1, generate forever
This commit is contained in:
		| @@ -11,6 +11,6 @@ cd .. | |||||||
| # | # | ||||||
| #   "--keep 48" is based on the contents of prompts/chat-with-bob.txt | #   "--keep 48" is based on the contents of prompts/chat-with-bob.txt | ||||||
| # | # | ||||||
| ./main -m ./models/7B/ggml-model-q4_0.bin -c 2048 -b 1024 -n 256 --keep 48 \ | ./main -m ./models/7B/ggml-model-q4_0.bin -c 512 -b 1024 -n 256 --keep 48 \ | ||||||
|     --repeat_penalty 1.0 --color -i \ |     --repeat_penalty 1.0 --color -i \ | ||||||
|     -r "User:" -f prompts/chat-with-bob.txt |     -r "User:" -f prompts/chat-with-bob.txt | ||||||
|   | |||||||
| @@ -204,7 +204,7 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) { | |||||||
|     fprintf(stderr, "  --in-prefix STRING    string to prefix user inputs with (default: empty)\n"); |     fprintf(stderr, "  --in-prefix STRING    string to prefix user inputs with (default: empty)\n"); | ||||||
|     fprintf(stderr, "  -f FNAME, --file FNAME\n"); |     fprintf(stderr, "  -f FNAME, --file FNAME\n"); | ||||||
|     fprintf(stderr, "                        prompt file to start generation.\n"); |     fprintf(stderr, "                        prompt file to start generation.\n"); | ||||||
|     fprintf(stderr, "  -n N, --n_predict N   number of tokens to predict (default: %d)\n", params.n_predict); |     fprintf(stderr, "  -n N, --n_predict N   number of tokens to predict (default: %d, -1 - infinity)\n", params.n_predict); | ||||||
|     fprintf(stderr, "  --top_k N             top-k sampling (default: %d)\n", params.top_k); |     fprintf(stderr, "  --top_k N             top-k sampling (default: %d)\n", params.top_k); | ||||||
|     fprintf(stderr, "  --top_p N             top-p sampling (default: %.1f)\n", params.top_p); |     fprintf(stderr, "  --top_p N             top-p sampling (default: %.1f)\n", params.top_p); | ||||||
|     fprintf(stderr, "  --repeat_last_n N     last n tokens to consider for penalize (default: %d)\n", params.repeat_last_n); |     fprintf(stderr, "  --repeat_last_n N     last n tokens to consider for penalize (default: %d)\n", params.repeat_last_n); | ||||||
|   | |||||||
| @@ -199,7 +199,6 @@ int main(int argc, char ** argv) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     params.n_keep    = std::min(params.n_keep,    (int) embd_inp.size()); |     params.n_keep    = std::min(params.n_keep,    (int) embd_inp.size()); | ||||||
|     //params.n_predict = std::min(params.n_predict, n_ctx - (int) embd_inp.size()); |  | ||||||
|  |  | ||||||
|     // prefix & suffix for instruct mode |     // prefix & suffix for instruct mode | ||||||
|     const auto inp_pfx = ::llama_tokenize(ctx, "\n\n### Instruction:\n\n", true); |     const auto inp_pfx = ::llama_tokenize(ctx, "\n\n### Instruction:\n\n", true); | ||||||
| @@ -293,7 +292,7 @@ int main(int argc, char ** argv) { | |||||||
|  |  | ||||||
|     std::vector<llama_token> embd; |     std::vector<llama_token> embd; | ||||||
|  |  | ||||||
|     while (n_remain > 0 || params.interactive) { |     while (n_remain != 0 || params.interactive) { | ||||||
|         // predict |         // predict | ||||||
|         if (embd.size() > 0) { |         if (embd.size() > 0) { | ||||||
|             // infinite text generation via context swapping |             // infinite text generation via context swapping | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Georgi Gerganov
					Georgi Gerganov