aboutsummaryrefslogtreecommitdiff
path: root/examples/main/main.cpp
diff options
context:
space:
mode:
authorStephan Walter <stephan@walter.name>2023-03-28 16:48:20 +0000
committerGitHub <noreply@github.com>2023-03-28 19:48:20 +0300
commit436e56193199a1625f8c561069f702e8840a9e08 (patch)
tree9e7f39e1736ccff5728bb6194f160dfa94cf552d /examples/main/main.cpp
parent20e1e84884376b3fb44ffbfd48d478b2934b0b5e (diff)
all : be more strict about converting float to double (#458)
* Be more strict about converting float to double * Test equivalence of round, SILU implementations Test module is commented out in CMakeLists.txt because the tests may take a long time, depending on how much the compiler optimizes. * Fix softmax in perplexity.cpp * all : prefer float over double where appropriate * perplexity : add <cmath> --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Diffstat (limited to 'examples/main/main.cpp')
-rw-r--r--examples/main/main.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index d5ab2cf..3130aef 100644
--- a/examples/main/main.cpp
+++ b/examples/main/main.cpp
@@ -209,7 +209,8 @@ int main(int argc, char ** argv) {
fprintf(stderr, "Input prefix: '%s'\n", params.input_prefix.c_str());
}
}
- fprintf(stderr, "sampling: temp = %f, top_k = %d, top_p = %f, repeat_last_n = %i, repeat_penalty = %f\n", params.temp, params.top_k, params.top_p, params.repeat_last_n, params.repeat_penalty);
+ fprintf(stderr, "sampling: temp = %f, top_k = %d, top_p = %f, repeat_last_n = %i, repeat_penalty = %f\n",
+ params.temp, params.top_k, params.top_p, params.repeat_last_n, params.repeat_penalty);
fprintf(stderr, "generate: n_ctx = %d, n_batch = %d, n_predict = %d, n_keep = %d\n", n_ctx, params.n_batch, params.n_predict, params.n_keep);
fprintf(stderr, "\n\n");
@@ -274,10 +275,10 @@ int main(int argc, char ** argv) {
if ((int) embd_inp.size() <= n_consumed && !is_interacting) {
// out of user input, sample next token
- const float top_k = params.top_k;
- const float top_p = params.top_p;
- const float temp = params.temp;
- const float repeat_penalty = params.repeat_penalty;
+ const int32_t top_k = params.top_k;
+ const float top_p = params.top_p;
+ const float temp = params.temp;
+ const float repeat_penalty = params.repeat_penalty;
llama_token id = 0;