-
Notifications
You must be signed in to change notification settings - Fork 19.7k
llama : suppress misleading Gemma4Assistant error during memory fitting #24590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,10 @@ | |
| // llama_context | ||
| // | ||
|
|
||
| class llama_exception : public std::runtime_error { | ||
| using std::runtime_error::runtime_error; | ||
| }; | ||
|
|
||
| static llm_graph_type ctx_type_to_graph_type(llama_context_type ctx_type) { | ||
| switch (ctx_type) { | ||
| case LLAMA_CONTEXT_TYPE_DEFAULT: return LLM_GRAPH_TYPE_DEFAULT; | ||
|
|
@@ -93,8 +97,7 @@ llama_context::llama_context( | |
| // TODO: more generic | ||
| if (model.arch == LLM_ARCH_GEMMA4_ASSISTANT) { | ||
| if (params.ctx_other == nullptr) { | ||
| // TODO: change from runtime_error to llama_exception to avoid printing error message | ||
| throw std::runtime_error("Gemma4Assistant requires ctx_other to be set (this warning is normal during memory fitting)"); | ||
| throw llama_exception("Gemma4Assistant requires ctx_other to be set (this warning is normal during memory fitting)"); | ||
| } | ||
|
|
||
| cparams.ctx_other = params.ctx_other; | ||
|
|
@@ -103,7 +106,7 @@ llama_context::llama_context( | |
| if (model.arch == LLM_ARCH_EAGLE3) { | ||
| if (model.tok_embd == nullptr || model.output == nullptr) { | ||
| if (params.ctx_other == nullptr) { | ||
| throw std::runtime_error("EAGLE3 requires ctx_other to be set (this warning is normal during memory fitting)"); | ||
| throw llama_exception("EAGLE3 requires ctx_other to be set (this warning is normal during memory fitting)"); | ||
| } | ||
| cparams.ctx_other = params.ctx_other; | ||
| } | ||
|
|
@@ -3560,6 +3563,8 @@ llama_context * llama_init_from_model( | |
| try { | ||
| auto * ctx = new llama_context(*model, params); | ||
| return ctx; | ||
|
Comment on lines
3563
to
3565
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could add e.g.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *LLAMA_LOG_DEBUG |
||
| } catch (const llama_exception & err) { | ||
| LLAMA_LOG_WARN("%s: failed to initialize the context: %s\n", __func__, err.what()); | ||
| } catch (const std::exception & err) { | ||
|
Comment on lines
+3566
to
3568
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can rename |
||
| LLAMA_LOG_ERROR("%s: failed to initialize the context: %s\n", __func__, err.what()); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can update to a
structor move tosrc\llama-impl.hif preferred