char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

SamareshSinghFix locale-dependent float printing in GGUF metadata (#17331)cb8f4fa3f

char/aliceai-t5-moe
1.2 KiB38 linesraw
1// Warns users that this filename was deprecated, and provides a link for more information.
2
3#include <clocale>
4#include <cstdio>
5#include <string>
6#include <unordered_map>
7
8// Main
9int main(int argc, char** argv) {
10    std::setlocale(LC_NUMERIC, "C");
11
12    std::string filename = "main";
13    if (argc >= 1) {
14        filename = argv[0];
15    }
16
17    // Get only the program name from the full path
18    auto pos = filename.find_last_of("/\\");
19    if (pos != std::string::npos) {
20        filename = filename.substr(pos+1);
21    }
22
23    // Append "llama-" to the beginning of filename to get the replacemnt filename
24    auto replacement_filename = "llama-" + filename;
25
26    // The exception is if the filename is "main", then our replacement filename is "llama-cli"
27    if (filename == "main") {
28        replacement_filename = "llama-cli";
29    }
30
31    fprintf(stdout, "\n");
32    fprintf(stdout, "WARNING: The binary '%s' is deprecated.\n", filename.c_str());
33    fprintf(stdout, " Please use '%s' instead.\n", replacement_filename.c_str());
34    fprintf(stdout, " See https://github.com/ggml-org/llama.cpp/tree/master/examples/deprecation-warning/README.md for more information.\n");
35    fprintf(stdout, "\n");
36
37    return EXIT_FAILURE;
38}