* llama : remove deprecated `llama_set_warmup` Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : remove remaining deprecated API Drop the APIs marked DEPRECATED in llama.h, the deprecated llama_context_params::defrag_thold field and the --defrag-thold option. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * fit-params : remove stale `llama-ext.h` include Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : document `llama_model_dflash_selector_top_k` Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : promote the NextN / speculative API from `llama-ext.h` Move the NextN, layer input, embd row and state row APIs to `llama.h` and rename `llama_set_embd_state_src` to `llama_set_ctx_state_src`, with the internal `llama_context::set_state_src` following the same name. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : polish the NextN API promotion Move the NextN draft model queries next to the Adapters section, rename the `src` parameters of `llama_set_ctx_state_src` and `llama_context::set_ctx_state_src` to `ctx_src`, and drop the now-redundant `llama-ext.h` includes from `common/speculative.cpp` and `tools/imatrix`. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB)
78 lines
2.6 KiB
C++
78 lines
2.6 KiB
C++
#include "llama.h"
|
|
|
|
#include "arg.h"
|
|
#include "common.h"
|
|
#include "fit.h"
|
|
#include "log.h"
|
|
|
|
#include <cinttypes>
|
|
|
|
#if defined(_MSC_VER)
|
|
#pragma warning(disable: 4244 4267) // possible loss of data
|
|
#endif
|
|
|
|
// satisfies -Wmissing-declarations
|
|
int llama_fit_params(int argc, char ** argv);
|
|
|
|
int llama_fit_params(int argc, char ** argv) {
|
|
common_params params;
|
|
|
|
common_init();
|
|
|
|
if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_FIT_PARAMS)) {
|
|
return 1;
|
|
}
|
|
|
|
llama_backend_init();
|
|
llama_numa_init(params.numa);
|
|
|
|
auto mparams = common_model_params_to_llama(params);
|
|
auto cparams = common_context_params_to_llama(params);
|
|
|
|
if (!params.fit_params_print) {
|
|
const common_params_fit_status status = common_fit_params(params.model.get_paths(), &mparams, &cparams,
|
|
params.tensor_split, params.tensor_buft_overrides.data(), params.fit_params_target.data(), params.fit_params_min_ctx,
|
|
nullptr,
|
|
params.verbosity >= LOG_LEVEL_DEBUG ? GGML_LOG_LEVEL_DEBUG : GGML_LOG_LEVEL_ERROR);
|
|
if (status != COMMON_PARAMS_FIT_STATUS_SUCCESS) {
|
|
LOG_ERR("%s: failed to fit CLI arguments to free memory, exiting...\n", __func__);
|
|
exit(1);
|
|
}
|
|
|
|
LOG_INF("%s: printing fitted CLI arguments to stdout...\n", __func__);
|
|
common_log_flush(common_log_main());
|
|
printf("-c %" PRIu32 " -ngl %" PRIi32, cparams.n_ctx, mparams.n_gpu_layers);
|
|
|
|
size_t nd = llama_max_devices();
|
|
while (nd > 1 && mparams.tensor_split[nd - 1] == 0.0f) {
|
|
nd--;
|
|
}
|
|
if (nd > 1) {
|
|
for (size_t id = 0; id < nd; id++) {
|
|
if (id == 0) {
|
|
printf(" -ts ");
|
|
}
|
|
printf("%s%" PRIu32, id > 0 ? "," : "", uint32_t(mparams.tensor_split[id]));
|
|
}
|
|
}
|
|
|
|
const size_t ntbo = llama_max_tensor_buft_overrides();
|
|
bool any_tbo = false;
|
|
for (size_t itbo = 0; itbo < ntbo && mparams.tensor_buft_overrides[itbo].pattern != nullptr; itbo++) {
|
|
if (itbo == 0) {
|
|
printf(" -ot \"");
|
|
}
|
|
printf("%s%s=%s", itbo > 0 ? "," : "", mparams.tensor_buft_overrides[itbo].pattern, ggml_backend_buft_name(mparams.tensor_buft_overrides[itbo].buft));
|
|
any_tbo = true;
|
|
}
|
|
printf("%s\n", any_tbo ? "\"" : "");
|
|
} else {
|
|
LOG_INF("%s: printing estimated memory in MiB to stdout (device, model, context, compute) ...\n", __func__);
|
|
common_log_flush(common_log_main());
|
|
|
|
common_fit_print(params.model.get_paths(), &mparams, &cparams);
|
|
}
|
|
|
|
return 0;
|
|
}
|