Skip to content

Commit 98e480a

Browse files
authored
app : move licences to llama-app (#23824)
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
1 parent 241cbd4 commit 98e480a

7 files changed

Lines changed: 23 additions & 28 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,6 @@ if (LLAMA_BUILD_APP)
222222
add_subdirectory(app)
223223
endif()
224224

225-
# Automatically add all files from the 'licenses' directory
226-
file(GLOB EXTRA_LICENSES "${CMAKE_SOURCE_DIR}/licenses/LICENSE-*")
227-
228-
foreach(FILE_PATH ${EXTRA_LICENSES})
229-
get_filename_component(FILE_NAME "${FILE_PATH}" NAME)
230-
string(REGEX REPLACE "^LICENSE-" "" NAME "${FILE_NAME}")
231-
license_add_file("${NAME}" "${FILE_PATH}")
232-
endforeach()
233-
234-
if (LLAMA_BUILD_COMMON)
235-
license_generate(llama-common)
236-
endif()
237-
238225
#
239226
# install
240227
#

app/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ target_link_libraries(${TARGET} PRIVATE
1515
)
1616
target_compile_features(${TARGET} PRIVATE cxx_std_17)
1717

18+
# Automatically add all files from the 'licenses' directory
19+
file(GLOB EXTRA_LICENSES "${CMAKE_SOURCE_DIR}/licenses/LICENSE-*")
20+
21+
foreach(FILE_PATH ${EXTRA_LICENSES})
22+
get_filename_component(FILE_NAME "${FILE_PATH}" NAME)
23+
string(REGEX REPLACE "^LICENSE-" "" NAME "${FILE_NAME}")
24+
license_add_file("${NAME}" "${FILE_PATH}")
25+
endforeach()
26+
27+
license_generate(${TARGET})
28+
1829
if(LLAMA_TOOLS_INSTALL)
1930
install(TARGETS ${TARGET} RUNTIME)
2031
endif()

app/llama.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include <string>
66
#include <vector>
77

8+
// embedded data generated by cmake
9+
extern const char * LICENSES[];
10+
811
// visible
912
int llama_server(int argc, char ** argv);
1013
int llama_cli(int argc, char ** argv);
@@ -21,6 +24,7 @@ static const char * progname;
2124

2225
static int help(int argc, char ** argv);
2326
static int version(int argc, char ** argv);
27+
static int licenses(int argc, char ** argv);
2428

2529
struct command {
2630
const char * name;
@@ -40,6 +44,7 @@ static const command cmds[] = {
4044
{"quantize", "Quantize a model", {}, true, llama_quantize },
4145
{"perplexity", "Compute model perplexity and KL divergence", {}, true, llama_perplexity },
4246
{"version", "Show version", {}, false, version },
47+
{"licenses", "Show third-party licenses", {"credits"}, false, licenses },
4348
{"help", "Show available commands", {}, false, help },
4449
};
4550

@@ -48,6 +53,13 @@ static int version(int argc, char ** argv) {
4853
return 0;
4954
}
5055

56+
static int licenses(int argc, char ** argv) {
57+
for (int i = 0; LICENSES[i]; ++i) {
58+
printf("%s\n", LICENSES[i]);
59+
}
60+
return 0;
61+
}
62+
5163
static int help(int argc, char ** argv) {
5264
const bool show_all = argc >= 2 && std::string(argv[1]) == "all";
5365

common/arg.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050

5151
#define LLAMA_MAX_URL_LENGTH 2084 // Maximum URL Length in Chrome: 2083
5252

53-
extern const char * LICENSES[];
54-
5553
using json = nlohmann::ordered_json;
5654
using namespace common_arg_utils;
5755

@@ -1091,16 +1089,6 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
10911089
exit(0);
10921090
}
10931091
));
1094-
add_opt(common_arg(
1095-
{"--license"},
1096-
"show source code license and dependencies",
1097-
[](common_params &) {
1098-
for (int i = 0; LICENSES[i]; ++i) {
1099-
printf("%s\n", LICENSES[i]);
1100-
}
1101-
exit(0);
1102-
}
1103-
));
11041092
add_opt(common_arg(
11051093
{"-cl", "--cache-list"},
11061094
"show list of models in cache",

tools/cli/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
| -------- | ----------- |
1313
| `-h, --help, --usage` | print usage and exit |
1414
| `--version` | show version and build info |
15-
| `--license` | show source code license and dependencies |
1615
| `-cl, --cache-list` | show list of models in cache |
1716
| `--completion-bash` | print source-able bash completion script for llama.cpp |
1817
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |

tools/completion/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ llama-completion.exe -m models\gemma-1.1-7b-it.Q4_K_M.gguf --ignore-eos -n -1
9595
| -------- | ----------- |
9696
| `-h, --help, --usage` | print usage and exit |
9797
| `--version` | show version and build info |
98-
| `--license` | show source code license and dependencies |
9998
| `-cl, --cache-list` | show list of models in cache |
10099
| `--completion-bash` | print source-able bash completion script for llama.cpp |
101100
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |

tools/server/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ For the full list of features, please refer to [server's changelog](https://gith
3333
| -------- | ----------- |
3434
| `-h, --help, --usage` | print usage and exit |
3535
| `--version` | show version and build info |
36-
| `--license` | show source code license and dependencies |
3736
| `-cl, --cache-list` | show list of models in cache |
3837
| `--completion-bash` | print source-able bash completion script for llama.cpp |
3938
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |

0 commit comments

Comments
 (0)