Skip to content

llama_fit_params: return enum for fail vs. error#18374

Merged
JohannesGaessler merged 1 commit intoggml-org:masterfrom
JohannesGaessler:llama-fp-status-code
Dec 27, 2025
Merged

llama_fit_params: return enum for fail vs. error#18374
JohannesGaessler merged 1 commit intoggml-org:masterfrom
JohannesGaessler:llama-fp-status-code

Conversation

@JohannesGaessler
Copy link
Copy Markdown
Contributor

See discussion in #18236 .

This PR makes it so that llama_params_fit returns an enum rather than a boolean in order to differentiate between success, failure of the algorithm, and hard errors due to e.g. the model file not being found.

@JohannesGaessler JohannesGaessler merged commit a52dc60 into ggml-org:master Dec 27, 2025
70 of 71 checks passed
mparams.tensor_buft_overrides = tensor_buft_overrides;
throw std::runtime_error("llama_params_fit_n_tensor_buft_overrides() == "
throw llama_params_fit_exception("llama_params_fit_n_tensor_buft_overrides() == "
+ std::to_string(ntbo) + " is insufficient for model\n");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ std::to_string(ntbo) + " is insufficient for model\n");
+ std::to_string(ntbo) + " is insufficient for model");

itbo++;
mparams.tensor_buft_overrides = tensor_buft_overrides;
throw std::runtime_error("llama_params_fit_n_tensor_buft_overrides() == "
throw llama_params_fit_exception("llama_params_fit_n_tensor_buft_overrides() == "
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The llama_params_fit_n_tensor_buft_overrides() symbol seems outdated?

@JohannesGaessler
Copy link
Copy Markdown
Contributor Author

Sorry, I was just a little bit too early. I'll add the changes to another, related PR. (Also I'll update the libllama changelog.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants