MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / main

Function main

examples/simple/simple.cpp:14–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14int main(int argc, char ** argv) {
15 std::setlocale(LC_NUMERIC, "C");
16
17 // path to the model gguf file
18 std::string model_path;
19 // prompt to generate text from
20 std::string prompt = "Hello my name is";
21 // number of layers to offload to the GPU
22 int ngl = 99;
23 // number of tokens to predict
24 int n_predict = 32;
25
26 // parse command line arguments
27
28 {
29 int i = 1;
30 for (; i < argc; i++) {
31 if (strcmp(argv[i], "-m") == 0) {
32 if (i + 1 < argc) {
33 model_path = argv[++i];
34 } else {
35 print_usage(argc, argv);
36 return 1;
37 }
38 } else if (strcmp(argv[i], "-n") == 0) {
39 if (i + 1 < argc) {
40 try {
41 n_predict = std::stoi(argv[++i]);
42 } catch (...) {
43 print_usage(argc, argv);
44 return 1;
45 }
46 } else {
47 print_usage(argc, argv);
48 return 1;
49 }
50 } else if (strcmp(argv[i], "-ngl") == 0) {
51 if (i + 1 < argc) {
52 try {
53 ngl = std::stoi(argv[++i]);
54 } catch (...) {
55 print_usage(argc, argv);
56 return 1;
57 }
58 } else {
59 print_usage(argc, argv);
60 return 1;
61 }
62 } else {
63 // prompt starts here
64 break;
65 }
66 }
67 if (model_path.empty()) {
68 print_usage(argc, argv);
69 return 1;
70 }
71 if (i < argc) {

Callers

nothing calls this directly

Calls 15

ggml_backend_load_allFunction · 0.85
llama_model_get_vocabFunction · 0.85
llama_tokenizeFunction · 0.85
llama_init_from_modelFunction · 0.85
llama_sampler_chain_initFunction · 0.85
llama_sampler_chain_addFunction · 0.85
llama_token_to_pieceFunction · 0.85

Tested by

no test coverage detected