Skip to content

Commit 9fb13f9

Browse files
authored
common : add --version option to show build info in CLI (#4433)
1 parent 113f994 commit 9fb13f9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

common/common.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ bool gpt_params_parse_ex(int argc, char ** argv, gpt_params & params) {
656656
} else if (arg == "-h" || arg == "--help") {
657657
return false;
658658

659+
} else if (arg == "--version") {
660+
fprintf(stderr, "version: %d (%s)\n", LLAMA_BUILD_NUMBER, LLAMA_COMMIT);
661+
fprintf(stderr, "built with %s for %s\n", LLAMA_COMPILER, LLAMA_BUILD_TARGET);
662+
exit(0);
659663
} else if (arg == "--random-prompt") {
660664
params.random_prompt = true;
661665
} else if (arg == "--in-prefix-bos") {
@@ -794,6 +798,7 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
794798
printf("\n");
795799
printf("options:\n");
796800
printf(" -h, --help show this help message and exit\n");
801+
printf(" --version show version and build info\n");
797802
printf(" -i, --interactive run in interactive mode\n");
798803
printf(" --interactive-first run in interactive mode and wait for input right away\n");
799804
printf(" -ins, --instruct run in instruction mode (use with Alpaca models)\n");

0 commit comments

Comments
 (0)