You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deprecation warning to assist with migration to new binary names (#8283)
* Adding a simple program to provide a deprecation warning that can exist to help people notice the binary name change from #7809 and migrate to the new filenames.
* Build legacy replacement binaries only if they already exist. Check for their existence every time so that they are not ignored.
# Legacy build targets that were renamed in #7809, but we want to build binaries that for them that output a deprecation warning if people try to use them.
72
+
# We don't want to clutter things too much, so we only build replacements for the most commonly used binaries.
73
+
LEGACY_TARGETS_BUILD = main quantize perplexity embedding server finetune
74
+
71
75
# Deprecation aliases
72
76
ifdefLLAMA_CUBLAS
73
77
$(error LLAMA_CUBLAS is removed. Use GGML_CUDA instead.)
[2024 Jun 12] Binaries have been renamed w/ a `llama-` prefix. `main` is now `llama-cli`, `server` is `llama-server`, etc (https://github.com/ggerganov/llama.cpp/pull/7809)
5
+
6
+
This migration was important, but it is a breaking change that may not always be immediately obvious to users.
7
+
8
+
Please update all scripts and workflows to use the new binary names.
// Warns users that this filename was deprecated, and provides a link for more information.
2
+
3
+
#include<cstdio>
4
+
#include<string>
5
+
#include<unordered_map>
6
+
7
+
// Main
8
+
intmain(int argc, char** argv) {
9
+
std::string filename = "main";
10
+
if (argc >= 1) {
11
+
filename = argv[0];
12
+
}
13
+
14
+
// Get only the program name from the full path
15
+
auto pos = filename.find_last_of('/');
16
+
if (pos != std::string::npos) {
17
+
filename = filename.substr(pos+1);
18
+
}
19
+
20
+
// Append "llama-" to the beginning of filename to get the replacemnt filename
21
+
auto replacement_filename = "llama-" + filename;
22
+
23
+
// The exception is if the filename is "main", then our replacement filename is "llama-cli"
24
+
if (filename == "main") {
25
+
replacement_filename = "llama-cli";
26
+
}
27
+
28
+
fprintf(stdout, "\n");
29
+
fprintf(stdout, "WARNING: The binary '%s' is deprecated.\n", filename.c_str());
30
+
fprintf(stdout, " Please use '%s' instead.\n", replacement_filename.c_str());
31
+
fprintf(stdout, " See https://github.com/ggerganov/llama.cpp/tree/master/examples/deprecation-warning/README.md for more information.\n");
0 commit comments