app : move licences to llama-app (#23824)
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
@@ -222,19 +222,6 @@ if (LLAMA_BUILD_APP)
|
|||||||
add_subdirectory(app)
|
add_subdirectory(app)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Automatically add all files from the 'licenses' directory
|
|
||||||
file(GLOB EXTRA_LICENSES "${CMAKE_SOURCE_DIR}/licenses/LICENSE-*")
|
|
||||||
|
|
||||||
foreach(FILE_PATH ${EXTRA_LICENSES})
|
|
||||||
get_filename_component(FILE_NAME "${FILE_PATH}" NAME)
|
|
||||||
string(REGEX REPLACE "^LICENSE-" "" NAME "${FILE_NAME}")
|
|
||||||
license_add_file("${NAME}" "${FILE_PATH}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
if (LLAMA_BUILD_COMMON)
|
|
||||||
license_generate(llama-common)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# install
|
# install
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -15,6 +15,17 @@ target_link_libraries(${TARGET} PRIVATE
|
|||||||
)
|
)
|
||||||
target_compile_features(${TARGET} PRIVATE cxx_std_17)
|
target_compile_features(${TARGET} PRIVATE cxx_std_17)
|
||||||
|
|
||||||
|
# Automatically add all files from the 'licenses' directory
|
||||||
|
file(GLOB EXTRA_LICENSES "${CMAKE_SOURCE_DIR}/licenses/LICENSE-*")
|
||||||
|
|
||||||
|
foreach(FILE_PATH ${EXTRA_LICENSES})
|
||||||
|
get_filename_component(FILE_NAME "${FILE_PATH}" NAME)
|
||||||
|
string(REGEX REPLACE "^LICENSE-" "" NAME "${FILE_NAME}")
|
||||||
|
license_add_file("${NAME}" "${FILE_PATH}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
license_generate(${TARGET})
|
||||||
|
|
||||||
if(LLAMA_TOOLS_INSTALL)
|
if(LLAMA_TOOLS_INSTALL)
|
||||||
install(TARGETS ${TARGET} RUNTIME)
|
install(TARGETS ${TARGET} RUNTIME)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
// embedded data generated by cmake
|
||||||
|
extern const char * LICENSES[];
|
||||||
|
|
||||||
// visible
|
// visible
|
||||||
int llama_server(int argc, char ** argv);
|
int llama_server(int argc, char ** argv);
|
||||||
int llama_cli(int argc, char ** argv);
|
int llama_cli(int argc, char ** argv);
|
||||||
@@ -21,6 +24,7 @@ static const char * progname;
|
|||||||
|
|
||||||
static int help(int argc, char ** argv);
|
static int help(int argc, char ** argv);
|
||||||
static int version(int argc, char ** argv);
|
static int version(int argc, char ** argv);
|
||||||
|
static int licenses(int argc, char ** argv);
|
||||||
|
|
||||||
struct command {
|
struct command {
|
||||||
const char * name;
|
const char * name;
|
||||||
@@ -40,6 +44,7 @@ static const command cmds[] = {
|
|||||||
{"quantize", "Quantize a model", {}, true, llama_quantize },
|
{"quantize", "Quantize a model", {}, true, llama_quantize },
|
||||||
{"perplexity", "Compute model perplexity and KL divergence", {}, true, llama_perplexity },
|
{"perplexity", "Compute model perplexity and KL divergence", {}, true, llama_perplexity },
|
||||||
{"version", "Show version", {}, false, version },
|
{"version", "Show version", {}, false, version },
|
||||||
|
{"licenses", "Show third-party licenses", {"credits"}, false, licenses },
|
||||||
{"help", "Show available commands", {}, false, help },
|
{"help", "Show available commands", {}, false, help },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,6 +53,13 @@ static int version(int argc, char ** argv) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int licenses(int argc, char ** argv) {
|
||||||
|
for (int i = 0; LICENSES[i]; ++i) {
|
||||||
|
printf("%s\n", LICENSES[i]);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int help(int argc, char ** argv) {
|
static int help(int argc, char ** argv) {
|
||||||
const bool show_all = argc >= 2 && std::string(argv[1]) == "all";
|
const bool show_all = argc >= 2 && std::string(argv[1]) == "all";
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,6 @@
|
|||||||
|
|
||||||
#define LLAMA_MAX_URL_LENGTH 2084 // Maximum URL Length in Chrome: 2083
|
#define LLAMA_MAX_URL_LENGTH 2084 // Maximum URL Length in Chrome: 2083
|
||||||
|
|
||||||
extern const char * LICENSES[];
|
|
||||||
|
|
||||||
using json = nlohmann::ordered_json;
|
using json = nlohmann::ordered_json;
|
||||||
using namespace common_arg_utils;
|
using namespace common_arg_utils;
|
||||||
|
|
||||||
@@ -1091,16 +1089,6 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
add_opt(common_arg(
|
|
||||||
{"--license"},
|
|
||||||
"show source code license and dependencies",
|
|
||||||
[](common_params &) {
|
|
||||||
for (int i = 0; LICENSES[i]; ++i) {
|
|
||||||
printf("%s\n", LICENSES[i]);
|
|
||||||
}
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
));
|
|
||||||
add_opt(common_arg(
|
add_opt(common_arg(
|
||||||
{"-cl", "--cache-list"},
|
{"-cl", "--cache-list"},
|
||||||
"show list of models in cache",
|
"show list of models in cache",
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
| -------- | ----------- |
|
| -------- | ----------- |
|
||||||
| `-h, --help, --usage` | print usage and exit |
|
| `-h, --help, --usage` | print usage and exit |
|
||||||
| `--version` | show version and build info |
|
| `--version` | show version and build info |
|
||||||
| `--license` | show source code license and dependencies |
|
|
||||||
| `-cl, --cache-list` | show list of models in cache |
|
| `-cl, --cache-list` | show list of models in cache |
|
||||||
| `--completion-bash` | print source-able bash completion script for llama.cpp |
|
| `--completion-bash` | print source-able bash completion script for llama.cpp |
|
||||||
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |
|
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ llama-completion.exe -m models\gemma-1.1-7b-it.Q4_K_M.gguf --ignore-eos -n -1
|
|||||||
| -------- | ----------- |
|
| -------- | ----------- |
|
||||||
| `-h, --help, --usage` | print usage and exit |
|
| `-h, --help, --usage` | print usage and exit |
|
||||||
| `--version` | show version and build info |
|
| `--version` | show version and build info |
|
||||||
| `--license` | show source code license and dependencies |
|
|
||||||
| `-cl, --cache-list` | show list of models in cache |
|
| `-cl, --cache-list` | show list of models in cache |
|
||||||
| `--completion-bash` | print source-able bash completion script for llama.cpp |
|
| `--completion-bash` | print source-able bash completion script for llama.cpp |
|
||||||
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |
|
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ For the full list of features, please refer to [server's changelog](https://gith
|
|||||||
| -------- | ----------- |
|
| -------- | ----------- |
|
||||||
| `-h, --help, --usage` | print usage and exit |
|
| `-h, --help, --usage` | print usage and exit |
|
||||||
| `--version` | show version and build info |
|
| `--version` | show version and build info |
|
||||||
| `--license` | show source code license and dependencies |
|
|
||||||
| `-cl, --cache-list` | show list of models in cache |
|
| `-cl, --cache-list` | show list of models in cache |
|
||||||
| `--completion-bash` | print source-able bash completion script for llama.cpp |
|
| `--completion-bash` | print source-able bash completion script for llama.cpp |
|
||||||
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |
|
| `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) |
|
||||||
|
|||||||
Reference in New Issue
Block a user