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

Function main

tools/completion/completion.cpp:87–1003  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85#endif
86
87int main(int argc, char ** argv) {
88 std::setlocale(LC_NUMERIC, "C");
89
90 common_params params;
91 g_params = &params;
92
93 common_init();
94
95 if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_COMPLETION, print_usage)) {
96 return 1;
97 }
98
99 auto & sparams = params.sampling;
100
101 // save choice to use color for later
102 // (note for later: this is a slightly awkward choice)
103 console::init(params.simple_io, params.use_color);
104 atexit([]() { console::cleanup(); });
105
106 if (params.embedding) {
107 LOG_ERR("************\n");
108 LOG_ERR("%s: please use the 'embedding' tool for embedding calculations\n", __func__);
109 LOG_ERR("************\n\n");
110
111 return 0;
112 }
113
114 if (params.n_ctx != 0 && params.n_ctx < 8) {
115 LOG_WRN("%s: warning: minimum context size is 8, using minimum size.\n", __func__);
116 params.n_ctx = 8;
117 }
118
119 if (params.rope_freq_base != 0.0) {
120 LOG_WRN("%s: warning: changing RoPE frequency base to %g.\n", __func__, params.rope_freq_base);
121 }
122
123 if (params.rope_freq_scale != 0.0) {
124 LOG_WRN("%s: warning: scaling RoPE frequency by %g.\n", __func__, params.rope_freq_scale);
125 }
126
127 LOG_INF("%s: llama backend init\n", __func__);
128
129 llama_backend_init();
130 llama_numa_init(params.numa);
131
132 llama_model * model = nullptr;
133 llama_context * ctx = nullptr;
134 common_sampler * smpl = nullptr;
135
136 g_model = &model;
137 g_ctx = &ctx;
138 g_smpl = &smpl;
139
140 std::vector<common_chat_msg> chat_msgs;
141
142 // load the model and apply lora adapter, if any
143 LOG_INF("%s: load the model and apply lora adapter, if any\n", __func__);
144

Callers

nothing calls this directly

Calls 15

common_initFunction · 0.85
common_params_parseFunction · 0.85
initFunction · 0.85
cleanupFunction · 0.85
llama_backend_initFunction · 0.85
llama_numa_initFunction · 0.85
common_init_from_paramsFunction · 0.85
llama_get_memoryFunction · 0.85
llama_model_get_vocabFunction · 0.85
llama_perf_context_resetFunction · 0.85
ggml_backend_dev_by_typeFunction · 0.85

Tested by

no test coverage detected