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

Function main

examples/simple-chat/simple-chat.cpp:15–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15int main(int argc, char ** argv) {
16 std::setlocale(LC_NUMERIC, "C");
17
18 std::string model_path;
19 int ngl = 99;
20 int n_ctx = 2048;
21
22 // parse command line arguments
23 for (int i = 1; i < argc; i++) {
24 try {
25 if (strcmp(argv[i], "-m") == 0) {
26 if (i + 1 < argc) {
27 model_path = argv[++i];
28 } else {
29 print_usage(argc, argv);
30 return 1;
31 }
32 } else if (strcmp(argv[i], "-c") == 0) {
33 if (i + 1 < argc) {
34 n_ctx = std::stoi(argv[++i]);
35 } else {
36 print_usage(argc, argv);
37 return 1;
38 }
39 } else if (strcmp(argv[i], "-ngl") == 0) {
40 if (i + 1 < argc) {
41 ngl = std::stoi(argv[++i]);
42 } else {
43 print_usage(argc, argv);
44 return 1;
45 }
46 } else {
47 print_usage(argc, argv);
48 return 1;
49 }
50 } catch (std::exception & e) {
51 fprintf(stderr, "error: %s\n", e.what());
52 print_usage(argc, argv);
53 return 1;
54 }
55 }
56 if (model_path.empty()) {
57 print_usage(argc, argv);
58 return 1;
59 }
60
61 // only print errors
62 llama_log_set([](enum ggml_log_level level, const char * text, void * /* user_data */) {
63 if (level >= GGML_LOG_LEVEL_ERROR) {
64 fprintf(stderr, "%s", text);
65 }
66 }, nullptr);
67
68 // load dynamic backends
69 ggml_backend_load_all();
70
71 // initialize the model
72 llama_model_params model_params = llama_model_default_params();

Callers

nothing calls this directly

Calls 15

llama_log_setFunction · 0.85
ggml_backend_load_allFunction · 0.85
llama_model_get_vocabFunction · 0.85
llama_init_from_modelFunction · 0.85
llama_sampler_chain_initFunction · 0.85
llama_sampler_chain_addFunction · 0.85
llama_sampler_init_min_pFunction · 0.85
llama_sampler_init_tempFunction · 0.85

Tested by

no test coverage detected