From 54910bd4f3762b716e90b658beb68d349571057e Mon Sep 17 00:00:00 2001 From: standby24x7 Date: Wed, 4 Mar 2026 14:44:49 +0900 Subject: [PATCH 1/2] completion : Fix a typo in warning message (#20082) resuse -> reuse --- tools/completion/completion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/completion/completion.cpp b/tools/completion/completion.cpp index aed2c0e38fb..e13816f735e 100644 --- a/tools/completion/completion.cpp +++ b/tools/completion/completion.cpp @@ -376,7 +376,7 @@ int main(int argc, char ** argv) { // remove any "future" tokens that we might have inherited from the previous session if (session_tokens.size() > n_match) { if (!llama_memory_seq_rm(mem, -1, n_match, -1)) { - LOG_WRN("%s: unable to resuse common prefix (for example, when the memory is recurrent)\n", __func__); + LOG_WRN("%s: unable to reuse common prefix (for example, when the memory is recurrent)\n", __func__); llama_memory_clear(mem, true); session_tokens.clear(); n_match = 0; From cb8f4fa3f8e359e61ed570adb8a3c2ce74be5179 Mon Sep 17 00:00:00 2001 From: SamareshSingh <97642706+ssam18@users.noreply.github.com> Date: Wed, 4 Mar 2026 02:30:40 -0600 Subject: [PATCH 2/2] Fix locale-dependent float printing in GGUF metadata (#17331) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Set C locale for consistent float formatting across all binaries. * Add C locale setting to all tools binaries Add std::setlocale(LC_NUMERIC, "C") to all 16 binaries in the tools/ directory to ensure consistent floating-point formatting. * Apply suggestion from @JohannesGaessler --------- Co-authored-by: Johannes Gäßler --- examples/batched/batched.cpp | 3 +++ .../convert-llama2c-to-ggml.cpp | 12 ++++++++---- .../deprecation-warning/deprecation-warning.cpp | 3 +++ examples/diffusion/diffusion-cli.cpp | 3 +++ examples/embedding/embedding.cpp | 3 +++ examples/eval-callback/eval-callback.cpp | 4 ++++ examples/gen-docs/gen-docs.cpp | 3 +++ examples/gguf-hash/gguf-hash.cpp | 11 +++++++---- examples/gguf/gguf.cpp | 3 +++ examples/lookahead/lookahead.cpp | 5 ++++- examples/lookup/lookup-create.cpp | 3 +++ examples/lookup/lookup-merge.cpp | 3 +++ examples/lookup/lookup-stats.cpp | 5 ++++- examples/lookup/lookup.cpp | 3 +++ examples/parallel/parallel.cpp | 5 ++++- examples/passkey/passkey.cpp | 3 +++ examples/retrieval/retrieval.cpp | 3 +++ examples/save-load-state/save-load-state.cpp | 3 +++ examples/simple-chat/simple-chat.cpp | 3 +++ examples/simple/simple.cpp | 3 +++ examples/speculative-simple/speculative-simple.cpp | 3 +++ examples/speculative/speculative.cpp | 3 +++ examples/sycl/ls-sycl-device.cpp | 2 ++ examples/training/finetune.cpp | 3 +++ tools/batched-bench/batched-bench.cpp | 3 +++ tools/completion/completion.cpp | 3 +++ tools/cvector-generator/cvector-generator.cpp | 4 ++++ tools/export-lora/export-lora.cpp | 3 +++ tools/gguf-split/gguf-split.cpp | 3 +++ tools/imatrix/imatrix.cpp | 3 +++ tools/llama-bench/llama-bench.cpp | 3 ++- tools/mtmd/deprecation-warning.cpp | 3 +++ tools/mtmd/mtmd-cli.cpp | 2 ++ tools/perplexity/perplexity.cpp | 5 ++++- tools/quantize/quantize.cpp | 6 ++++++ tools/rpc/rpc-server.cpp | 13 +++++++++---- tools/server/server.cpp | 3 +++ tools/tokenize/tokenize.cpp | 3 +++ tools/tts/tts.cpp | 3 +++ 39 files changed, 138 insertions(+), 17 deletions(-) diff --git a/examples/batched/batched.cpp b/examples/batched/batched.cpp index a8c19a6aba6..d2b2e336e75 100644 --- a/examples/batched/batched.cpp +++ b/examples/batched/batched.cpp @@ -5,6 +5,7 @@ #include "sampling.h" #include +#include #include #include #include @@ -16,6 +17,8 @@ static void print_usage(int, char ** argv) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.prompt = "Hello my name is"; diff --git a/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp b/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp index 767198aafa2..702bc74bee2 100644 --- a/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp +++ b/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp @@ -5,14 +5,16 @@ #include "common.h" #include "log.h" -#include -#include +#include #include +#include #include -#include +#include #include -#include +#include #include +#include +#include #include #include #include @@ -874,6 +876,8 @@ static std::string basename(const std::string &path) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_init(); struct train_params params = get_default_train_params(); diff --git a/examples/deprecation-warning/deprecation-warning.cpp b/examples/deprecation-warning/deprecation-warning.cpp index 11f5147328a..0cde17f6e99 100644 --- a/examples/deprecation-warning/deprecation-warning.cpp +++ b/examples/deprecation-warning/deprecation-warning.cpp @@ -1,11 +1,14 @@ // Warns users that this filename was deprecated, and provides a link for more information. +#include #include #include #include // Main int main(int argc, char** argv) { + std::setlocale(LC_NUMERIC, "C"); + std::string filename = "main"; if (argc >= 1) { filename = argv[0]; diff --git a/examples/diffusion/diffusion-cli.cpp b/examples/diffusion/diffusion-cli.cpp index d50f754092d..d38bfe7f82d 100644 --- a/examples/diffusion/diffusion-cli.cpp +++ b/examples/diffusion/diffusion-cli.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -538,6 +539,8 @@ static std::string format_input_text(const std::string & prompt, const std::stri } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + ggml_time_init(); common_params params; diff --git a/examples/embedding/embedding.cpp b/examples/embedding/embedding.cpp index d8eaaa2691f..33ef2a7521f 100644 --- a/examples/embedding/embedding.cpp +++ b/examples/embedding/embedding.cpp @@ -3,6 +3,7 @@ #include "log.h" #include "llama.h" +#include #include #include @@ -94,6 +95,8 @@ static void print_raw_embeddings(const float * emb, } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_EMBEDDING)) { diff --git a/examples/eval-callback/eval-callback.cpp b/examples/eval-callback/eval-callback.cpp index bd587349798..17d162d95d3 100644 --- a/examples/eval-callback/eval-callback.cpp +++ b/examples/eval-callback/eval-callback.cpp @@ -4,6 +4,8 @@ #include "log.h" #include "llama.h" #include "llama-cpp.h" + +#include #include #include @@ -29,6 +31,8 @@ static bool run(llama_context * ctx, const common_params & params) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + base_callback_data cb_data; common_params params; diff --git a/examples/gen-docs/gen-docs.cpp b/examples/gen-docs/gen-docs.cpp index 0aa33e8245b..7ba7d79f721 100644 --- a/examples/gen-docs/gen-docs.cpp +++ b/examples/gen-docs/gen-docs.cpp @@ -1,6 +1,7 @@ #include "arg.h" #include "common.h" +#include #include #include #include @@ -100,6 +101,8 @@ static void write_help(std::ostringstream & ss, const md_file & md) { } int main(int, char **) { + std::setlocale(LC_NUMERIC, "C"); + for (const auto & md : md_files) { std::ifstream infile(md.fname); if (!infile.is_open()) { diff --git a/examples/gguf-hash/gguf-hash.cpp b/examples/gguf-hash/gguf-hash.cpp index 9523ec122f5..331de301ffc 100644 --- a/examples/gguf-hash/gguf-hash.cpp +++ b/examples/gguf-hash/gguf-hash.cpp @@ -1,13 +1,14 @@ #include "ggml.h" #include "gguf.h" -#include /* abort() */ +#include +#include #include #include -#include -#include -#include +#include /* abort() */ #include +#include +#include #include #include @@ -626,6 +627,8 @@ static hash_exit_code_t gguf_hash(const hash_params & hash_params) { } int main(int argc, const char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + hash_params params; manifest_check_params manifest_check; hash_params_parse(argc, argv, params); diff --git a/examples/gguf/gguf.cpp b/examples/gguf/gguf.cpp index 499cfacc92a..79ad38711e3 100644 --- a/examples/gguf/gguf.cpp +++ b/examples/gguf/gguf.cpp @@ -1,6 +1,7 @@ #include "ggml.h" #include "gguf.h" +#include #include #include #include @@ -240,6 +241,8 @@ static bool gguf_ex_read_1(const std::string & fname, bool check_data) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + if (argc < 3) { printf("usage: %s data.gguf r|w [n]\n", argv[0]); printf("r: read data.gguf file\n"); diff --git a/examples/lookahead/lookahead.cpp b/examples/lookahead/lookahead.cpp index aa6efa62b3b..d5fde081c59 100644 --- a/examples/lookahead/lookahead.cpp +++ b/examples/lookahead/lookahead.cpp @@ -4,10 +4,11 @@ #include "log.h" #include "llama.h" +#include +#include #include #include #include -#include struct ngram_data { bool active = false; @@ -38,6 +39,8 @@ struct ngram_container { }; int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_COMMON)) { diff --git a/examples/lookup/lookup-create.cpp b/examples/lookup/lookup-create.cpp index f7b6ea1b190..439e3f726ee 100644 --- a/examples/lookup/lookup-create.cpp +++ b/examples/lookup/lookup-create.cpp @@ -3,10 +3,13 @@ #include "ngram-cache.h" #include "llama.h" +#include #include #include int main(int argc, char ** argv){ + std::setlocale(LC_NUMERIC, "C"); + common_params params; if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_LOOKUP)) { diff --git a/examples/lookup/lookup-merge.cpp b/examples/lookup/lookup-merge.cpp index 6871c0f5fdb..ee3c7249cf1 100644 --- a/examples/lookup/lookup-merge.cpp +++ b/examples/lookup/lookup-merge.cpp @@ -3,6 +3,7 @@ #include "common.h" #include "ngram-cache.h" +#include #include #include #include @@ -17,6 +18,8 @@ static void print_usage(char* argv0) { } int main(int argc, char ** argv){ + std::setlocale(LC_NUMERIC, "C"); + if (argc < 3) { print_usage(argv[0]); exit(1); diff --git a/examples/lookup/lookup-stats.cpp b/examples/lookup/lookup-stats.cpp index ae28b2e6e86..c3158281c75 100644 --- a/examples/lookup/lookup-stats.cpp +++ b/examples/lookup/lookup-stats.cpp @@ -5,14 +5,17 @@ #include "llama.h" #include "ggml.h" +#include +#include #include #include -#include #include #include #include int main(int argc, char ** argv){ + std::setlocale(LC_NUMERIC, "C"); + common_params params; if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_LOOKUP)) { diff --git a/examples/lookup/lookup.cpp b/examples/lookup/lookup.cpp index c7552ddde14..bd216035c0b 100644 --- a/examples/lookup/lookup.cpp +++ b/examples/lookup/lookup.cpp @@ -6,6 +6,7 @@ #include "log.h" #include "llama.h" +#include #include #include #include @@ -13,6 +14,8 @@ #include int main(int argc, char ** argv){ + std::setlocale(LC_NUMERIC, "C"); + common_params params; if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_LOOKUP)) { diff --git a/examples/parallel/parallel.cpp b/examples/parallel/parallel.cpp index c92173ae291..1700ceefbf7 100644 --- a/examples/parallel/parallel.cpp +++ b/examples/parallel/parallel.cpp @@ -7,12 +7,13 @@ #include "log.h" #include "llama.h" +#include +#include #include #include #include #include #include -#include // trim whitespace from the beginning and end of a string static std::string trim(const std::string & str) { @@ -153,6 +154,8 @@ static std::vector split_string(const std::string& input, char deli } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + srand(1234); common_params params; diff --git a/examples/passkey/passkey.cpp b/examples/passkey/passkey.cpp index 8a4faa383bf..665191047a4 100644 --- a/examples/passkey/passkey.cpp +++ b/examples/passkey/passkey.cpp @@ -3,6 +3,7 @@ #include "log.h" #include "llama.h" +#include #include #include #include @@ -16,6 +17,8 @@ static void print_usage(int, char ** argv) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.n_junk = 250; diff --git a/examples/retrieval/retrieval.cpp b/examples/retrieval/retrieval.cpp index 3f2afd4346e..9e05fc22337 100644 --- a/examples/retrieval/retrieval.cpp +++ b/examples/retrieval/retrieval.cpp @@ -4,6 +4,7 @@ #include "llama.h" #include +#include #include #include // TODO: remove me @@ -112,6 +113,8 @@ static void batch_process(llama_context * ctx, llama_batch & batch, float * outp } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_RETRIEVAL, print_usage)) { diff --git a/examples/save-load-state/save-load-state.cpp b/examples/save-load-state/save-load-state.cpp index 5e35dcd6030..174c8c75854 100644 --- a/examples/save-load-state/save-load-state.cpp +++ b/examples/save-load-state/save-load-state.cpp @@ -2,11 +2,14 @@ #include "common.h" #include "llama.h" +#include #include #include int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.prompt = "The quick brown fox"; diff --git a/examples/simple-chat/simple-chat.cpp b/examples/simple-chat/simple-chat.cpp index 57195df3316..97e9dc9842f 100644 --- a/examples/simple-chat/simple-chat.cpp +++ b/examples/simple-chat/simple-chat.cpp @@ -1,4 +1,5 @@ #include "llama.h" +#include #include #include #include @@ -12,6 +13,8 @@ static void print_usage(int, char ** argv) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + std::string model_path; int ngl = 99; int n_ctx = 2048; diff --git a/examples/simple/simple.cpp b/examples/simple/simple.cpp index d09771d1045..9f0a25d713f 100644 --- a/examples/simple/simple.cpp +++ b/examples/simple/simple.cpp @@ -1,4 +1,5 @@ #include "llama.h" +#include #include #include #include @@ -11,6 +12,8 @@ static void print_usage(int, char ** argv) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + // path to the model gguf file std::string model_path; // prompt to generate text from diff --git a/examples/speculative-simple/speculative-simple.cpp b/examples/speculative-simple/speculative-simple.cpp index d8b1f5a480c..8a1cbd96c25 100644 --- a/examples/speculative-simple/speculative-simple.cpp +++ b/examples/speculative-simple/speculative-simple.cpp @@ -5,12 +5,15 @@ #include "log.h" #include "llama.h" +#include #include #include #include #include int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_SPECULATIVE)) { diff --git a/examples/speculative/speculative.cpp b/examples/speculative/speculative.cpp index 3e5cf5f46b5..250c5b7c62d 100644 --- a/examples/speculative/speculative.cpp +++ b/examples/speculative/speculative.cpp @@ -5,6 +5,7 @@ #include "llama.h" #include +#include #include #include #include @@ -30,6 +31,8 @@ struct seq_draft { }; int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; // needed to get candidate probs even for temp <= 0.0 diff --git a/examples/sycl/ls-sycl-device.cpp b/examples/sycl/ls-sycl-device.cpp index 74a8b7fd814..3bdc4059825 100644 --- a/examples/sycl/ls-sycl-device.cpp +++ b/examples/sycl/ls-sycl-device.cpp @@ -6,8 +6,10 @@ #include "ggml-sycl.h" +#include int main() { + std::setlocale(LC_NUMERIC, "C"); ggml_backend_sycl_print_sycl_devices(); return 0; } diff --git a/examples/training/finetune.cpp b/examples/training/finetune.cpp index c82de8d35d0..e20f89488f2 100644 --- a/examples/training/finetune.cpp +++ b/examples/training/finetune.cpp @@ -3,6 +3,7 @@ #include "log.h" #include "llama.h" +#include #include #include #include @@ -14,6 +15,8 @@ #endif int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.escape = false; diff --git a/tools/batched-bench/batched-bench.cpp b/tools/batched-bench/batched-bench.cpp index 0f627c5ff65..224f0e1f1c6 100644 --- a/tools/batched-bench/batched-bench.cpp +++ b/tools/batched-bench/batched-bench.cpp @@ -4,6 +4,7 @@ #include "llama.h" #include +#include #include #include #include @@ -15,6 +16,8 @@ static void print_usage(int, char ** argv) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_BENCH, print_usage)) { diff --git a/tools/completion/completion.cpp b/tools/completion/completion.cpp index e13816f735e..2e0f0871847 100644 --- a/tools/completion/completion.cpp +++ b/tools/completion/completion.cpp @@ -6,6 +6,7 @@ #include "llama.h" #include "chat.h" +#include #include #include #include @@ -84,6 +85,8 @@ static void sigint_handler(int signo) { #endif int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; g_params = ¶ms; diff --git a/tools/cvector-generator/cvector-generator.cpp b/tools/cvector-generator/cvector-generator.cpp index 3ba7c529506..4c8ca61ec4f 100644 --- a/tools/cvector-generator/cvector-generator.cpp +++ b/tools/cvector-generator/cvector-generator.cpp @@ -7,6 +7,8 @@ #include "pca.hpp" #include "mean.hpp" +#include + #ifdef GGML_USE_CUDA #include "ggml-cuda.h" #endif @@ -392,6 +394,8 @@ static int prepare_entries(common_params & params, train_context & ctx_train) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.out_file = "control_vector.gguf"; diff --git a/tools/export-lora/export-lora.cpp b/tools/export-lora/export-lora.cpp index 41f426208f8..50774c59bae 100644 --- a/tools/export-lora/export-lora.cpp +++ b/tools/export-lora/export-lora.cpp @@ -5,6 +5,7 @@ #include "arg.h" #include "common.h" +#include #include #include #include @@ -411,6 +412,8 @@ static void print_usage(int, char ** argv) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.out_file = "ggml-lora-merged-f16.gguf"; diff --git a/tools/gguf-split/gguf-split.cpp b/tools/gguf-split/gguf-split.cpp index 30e771564e8..f99f0299b9c 100644 --- a/tools/gguf-split/gguf-split.cpp +++ b/tools/gguf-split/gguf-split.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -567,6 +568,8 @@ static void gguf_merge(const split_params & split_params) { } int main(int argc, const char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + split_params params; split_params_parse(argc, argv, params); diff --git a/tools/imatrix/imatrix.cpp b/tools/imatrix/imatrix.cpp index e025c114b48..bbedb159cd4 100644 --- a/tools/imatrix/imatrix.cpp +++ b/tools/imatrix/imatrix.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -1191,6 +1192,8 @@ static bool show_statistics(const common_params & params) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.out_file = "imatrix.gguf"; diff --git a/tools/llama-bench/llama-bench.cpp b/tools/llama-bench/llama-bench.cpp index 7da6c3957c7..7a750265505 100644 --- a/tools/llama-bench/llama-bench.cpp +++ b/tools/llama-bench/llama-bench.cpp @@ -2034,8 +2034,9 @@ static std::unique_ptr create_printer(output_formats format) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); // try to set locale for unicode characters in markdown - setlocale(LC_CTYPE, ".UTF-8"); + std::setlocale(LC_CTYPE, ".UTF-8"); #if !defined(NDEBUG) fprintf(stderr, "warning: asserts enabled, performance may be affected\n"); diff --git a/tools/mtmd/deprecation-warning.cpp b/tools/mtmd/deprecation-warning.cpp index dded0a56af9..2b31a9d8b0b 100644 --- a/tools/mtmd/deprecation-warning.cpp +++ b/tools/mtmd/deprecation-warning.cpp @@ -1,7 +1,10 @@ +#include #include #include int main(int argc, char** argv) { + std::setlocale(LC_NUMERIC, "C"); + std::string filename = "main"; if (argc >= 1) { filename = argv[0]; diff --git a/tools/mtmd/mtmd-cli.cpp b/tools/mtmd/mtmd-cli.cpp index 054c7faa6af..09b8e311c53 100644 --- a/tools/mtmd/mtmd-cli.cpp +++ b/tools/mtmd/mtmd-cli.cpp @@ -274,6 +274,8 @@ static int eval_message(mtmd_cli_context & ctx, common_chat_msg & msg) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + ggml_time_init(); common_params params; diff --git a/tools/perplexity/perplexity.cpp b/tools/perplexity/perplexity.cpp index 433b747f0d4..cc5ea99c4df 100644 --- a/tools/perplexity/perplexity.cpp +++ b/tools/perplexity/perplexity.cpp @@ -3,10 +3,11 @@ #include "log.h" #include "llama.h" -#include #include #include #include +#include +#include #include #include #include @@ -2004,6 +2005,8 @@ static void kl_divergence(llama_context * ctx, const common_params & params) { } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.n_ctx = 512; diff --git a/tools/quantize/quantize.cpp b/tools/quantize/quantize.cpp index 59bf9bd3fd0..0a483328ee5 100644 --- a/tools/quantize/quantize.cpp +++ b/tools/quantize/quantize.cpp @@ -2,6 +2,10 @@ #include "llama.h" #include "gguf.h" +#include +#include +#include +#include #include #include #include @@ -485,6 +489,8 @@ static bool parse_layer_prune(const char * data, std::vector & prune_layers } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + if (argc < 3) { usage(argv[0]); } diff --git a/tools/rpc/rpc-server.cpp b/tools/rpc/rpc-server.cpp index 6feb0e91f32..03ab78e5f05 100644 --- a/tools/rpc/rpc-server.cpp +++ b/tools/rpc/rpc-server.cpp @@ -10,12 +10,15 @@ # include # include #endif -#include -#include -#include #include -#include +#include +#include +#include #include +#include +#include +#include +#include #if defined(__linux__) #include @@ -285,6 +288,8 @@ static std::vector get_devices(const rpc_server_params & par } int main(int argc, char * argv[]) { + std::setlocale(LC_NUMERIC, "C"); + ggml_backend_load_all(); rpc_server_params params; diff --git a/tools/server/server.cpp b/tools/server/server.cpp index f353dcdde7b..fab0bb587f3 100644 --- a/tools/server/server.cpp +++ b/tools/server/server.cpp @@ -8,6 +8,7 @@ #include "log.h" #include +#include #include #include #include // for std::thread::hardware_concurrency @@ -67,6 +68,8 @@ static server_http_context::handler_t ex_wrapper(server_http_context::handler_t } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + // own arguments required by this example common_params params; diff --git a/tools/tokenize/tokenize.cpp b/tools/tokenize/tokenize.cpp index 7375759ebe2..32cf8c8eb99 100644 --- a/tools/tokenize/tokenize.cpp +++ b/tools/tokenize/tokenize.cpp @@ -2,6 +2,7 @@ //#include "log.h" // TODO: start using log.h #include "llama.h" +#include #include #include #include @@ -184,6 +185,8 @@ static void write_utf8_cstr_to_stdout(const char * str, bool & invalid_utf8) { } int main(int raw_argc, char ** raw_argv) { + std::setlocale(LC_NUMERIC, "C"); + const std::vector argv = ingest_args(raw_argc, raw_argv); const int argc = argv.size(); diff --git a/tools/tts/tts.cpp b/tools/tts/tts.cpp index ac55a8b1ca4..dc2fa494b88 100644 --- a/tools/tts/tts.cpp +++ b/tools/tts/tts.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -536,6 +537,8 @@ static std::string audio_data_from_speaker(json speaker, const outetts_version t } int main(int argc, char ** argv) { + std::setlocale(LC_NUMERIC, "C"); + common_params params; params.out_file = "output.wav";