diff --git a/examples/batched/batched.cpp b/examples/batched/batched.cpp index a8c19a6aba..d2b2e336e7 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 767198aafa..702bc74bee 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 #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 11f5147328..0cde17f6e9 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 d50f754092..d38bfe7f82 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 d8eaaa2691..33ef2a7521 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 bd58734979..17d162d95d 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 0aa33e8245..7ba7d79f72 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 9523ec122f..331de301ff 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 499cfacc92..79ad38711e 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 aa6efa62b3..d5fde081c5 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 f7b6ea1b19..439e3f726e 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 6871c0f5fd..ee3c7249cf 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 ae28b2e6e8..c3158281c7 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 c7552ddde1..bd216035c0 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 c92173ae29..1700ceefbf 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 8a4faa383b..665191047a 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 3f2afd4346..9e05fc2233 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 5e35dcd603..174c8c7585 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 57195df331..97e9dc9842 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 d09771d104..9f0a25d713 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 d8b1f5a480..8a1cbd96c2 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 3e5cf5f46b..250c5b7c62 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 74a8b7fd81..3bdc405982 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 c82de8d35d..e20f89488f 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 0f627c5ff6..224f0e1f1c 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 e13816f735..2e0f087184 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 3ba7c52950..4c8ca61ec4 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 41f426208f..50774c59ba 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 30e771564e..f99f0299b9 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 e025c114b4..bbedb159cd 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 7da6c3957c..7a75026550 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 dded0a56af..2b31a9d8b0 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 054c7faa6a..09b8e311c5 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 433b747f0d..cc5ea99c4d 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 59bf9bd3fd..0a483328ee 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 6feb0e91f3..03ab78e5f0 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 f353dcdde7..fab0bb587f 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 7375759ebe..32cf8c8eb9 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 ac55a8b1ca..dc2fa494b8 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";