| 739 | } |
| 740 | |
| 741 | enum llama_params_fit_status llama_params_fit( |
| 742 | const char * path_model, struct llama_model_params * mparams, struct llama_context_params * cparams, |
| 743 | float * tensor_split, struct llama_model_tensor_buft_override * tensor_buft_overrides, |
| 744 | size_t * margins, uint32_t n_ctx_min, enum ggml_log_level log_level) { |
| 745 | const int64_t t0_us = llama_time_us(); |
| 746 | llama_params_fit_status status = LLAMA_PARAMS_FIT_STATUS_SUCCESS; |
| 747 | try { |
| 748 | llama_params_fit_impl(path_model, mparams, cparams, tensor_split, tensor_buft_overrides, margins, n_ctx_min, log_level); |
| 749 | LLAMA_LOG_INFO("%s: successfully fit params to free device memory\n", __func__); |
| 750 | } catch (const llama_params_fit_exception & e) { |
| 751 | LLAMA_LOG_WARN("%s: failed to fit params to free device memory: %s\n", __func__, e.what()); |
| 752 | status = LLAMA_PARAMS_FIT_STATUS_FAILURE; |
| 753 | } catch (const std::runtime_error & e) { |
| 754 | LLAMA_LOG_ERROR("%s: encountered an error while trying to fit params to free device memory: %s\n", __func__, e.what()); |
| 755 | status = LLAMA_PARAMS_FIT_STATUS_ERROR; |
| 756 | } |
| 757 | const int64_t t1_us = llama_time_us(); |
| 758 | LLAMA_LOG_INFO("%s: fitting params to free memory took %.2f seconds\n", __func__, (t1_us - t0_us) * 1e-6); |
| 759 | return status; |
| 760 | } |
| 761 | |
| 762 | struct llama_sampler_chain_params llama_sampler_chain_default_params() { |
| 763 | struct llama_sampler_chain_params result = { |
no test coverage detected