common : move up common_init() and fix Windows UTF-8 logs (#21176)

The build info is now only for debug, so we avoid the duplicate
with `--version`.

The UTF-8 setup at the beginning is needed to avoid logging
garbage on Windows.

Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
Adrien Gallouët
2026-03-31 12:53:41 +02:00
committed by GitHub
parent 62278cedde
commit 41361c8599
34 changed files with 73 additions and 55 deletions
+3 -1
View File
@@ -58,6 +58,9 @@ static std::vector<float> get_logits(
int main(int argc, char ** argv) {
common_params params;
params.escape = false;
common_init();
if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_RESULTS)) {
return 1;
}
@@ -65,7 +68,6 @@ int main(int argc, char ** argv) {
LOG_ERR("%s: an output file must be specified", __func__);
return 1;
}
common_init();
llama_backend_init();
llama_numa_init(params.numa);
common_init_result_ptr llama_init = common_init_from_params(params);