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

Function common_params_handle_model

common/arg.cpp:333–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331};
332
333static handle_model_result common_params_handle_model(struct common_params_model & model,
334 const std::string & bearer_token,
335 bool offline) {
336 handle_model_result result;
337
338 if (!model.docker_repo.empty()) {
339 model.path = common_docker_resolve_model(model.docker_repo);
340 model.name = model.docker_repo;
341 } else if (!model.hf_repo.empty()) {
342 // If -m was used with -hf, treat the model "path" as the hf_file to download
343 if (model.hf_file.empty() && !model.path.empty()) {
344 model.hf_file = model.path;
345 model.path = "";
346 }
347 common_download_opts opts;
348 opts.bearer_token = bearer_token;
349 opts.offline = offline;
350 auto download_result = common_download_model(model, opts, true);
351
352 if (download_result.model_path.empty()) {
353 LOG_ERR("error: failed to download model from Hugging Face\n");
354 exit(1);
355 }
356
357 model.name = model.hf_repo;
358 model.path = download_result.model_path;
359
360 if (!download_result.mmproj_path.empty()) {
361 result.found_mmproj = true;
362 result.mmproj.path = download_result.mmproj_path;
363 }
364 } else if (!model.url.empty()) {
365 if (model.path.empty()) {
366 auto f = string_split<std::string>(model.url, '#').front();
367 f = string_split<std::string>(f, '?').front();
368 model.path = fs_get_cache_file(string_split<std::string>(f, '/').back());
369 }
370
371 common_download_opts opts;
372 opts.bearer_token = bearer_token;
373 opts.offline = offline;
374 auto download_result = common_download_model(model, opts);
375 if (download_result.model_path.empty()) {
376 LOG_ERR("error: failed to download model from %s\n", model.url.c_str());
377 exit(1);
378 }
379 }
380
381 return result;
382}
383
384const std::vector<ggml_type> kv_cache_types = {
385 GGML_TYPE_F32,

Callers 1

common_params_parse_exFunction · 0.85

Calls 4

common_download_modelFunction · 0.85
fs_get_cache_fileFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected