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

Function main

tests/export-graph-ops.cpp:128–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128int main(int argc, char ** argv) {
129 common_params params;
130 params.out_file = "tests.txt";
131
132 common_init();
133
134 if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_EXPORT_GRAPH_OPS)) {
135 return 1;
136 }
137
138 // Load CPU-only
139 ggml_backend_dev_t cpu_device = ggml_backend_dev_by_type(GGML_BACKEND_DEVICE_TYPE_CPU);
140 params.devices = { cpu_device, nullptr };
141 params.fit_params = false;
142 params.n_gpu_layers = 0;
143
144 params.warmup = false;
145
146 llama_context * ctx;
147 common_init_result_ptr init_result;
148 llama_context_ptr ctx2;
149 llama_model_ptr model;
150
151 if (params.model.hf_repo.empty()) {
152 init_result = common_init_from_params(params);
153
154 ctx = init_result->context();
155 } else {
156#ifdef LLAMA_HF_FETCH
157 auto [hf_repo, hf_quant] = common_download_split_repo_tag(params.model.hf_repo);
158 if (hf_quant.empty() || hf_quant == "latest") {
159 hf_quant = "Q4_K_M";
160 }
161
162 gguf_context_ptr gguf_ctx = gguf_fetch_gguf_ctx(hf_repo, hf_quant);
163 if (!gguf_ctx) {
164 LOG_ERR("failed to fetch GGUF metadata from %s\n", hf_repo.c_str());
165 return 1;
166 }
167
168 llama_model_params model_params = llama_model_default_params();
169 model_params.devices = params.devices.data();
170 model_params.no_alloc = true;
171
172 model.reset(llama_model_init_from_user(gguf_ctx.get(), set_tensor_data, nullptr, model_params));
173
174 if (!model) {
175 LOG_ERR("failed to create llama_model from %s\n", hf_repo.c_str());
176 return 1;
177 }
178
179 llama_context_params ctx_params = llama_context_default_params();
180 ctx2.reset(llama_init_from_model(model.get(), ctx_params));
181 ctx = ctx2.get();
182
183 if (!ctx) {
184 LOG_ERR("failed to create llama_context\n");
185 return 1;

Callers

nothing calls this directly

Calls 15

common_initFunction · 0.85
common_params_parseFunction · 0.85
ggml_backend_dev_by_typeFunction · 0.85
common_init_from_paramsFunction · 0.85
gguf_fetch_gguf_ctxFunction · 0.85
llama_init_from_modelFunction · 0.85
llama_n_seq_maxFunction · 0.85
minFunction · 0.85

Tested by

no test coverage detected