Skip to content

Conversation

wooksong
Copy link
Contributor

Hello llama.cpp team,

While working through the docs/development/HOWTO‑add‑model.md guide to add a new model, I noticed that the example still uses @Model.register("MyModelForCausalLM") and class MyModel(Model).

In #13023, the model base class was renamed from Model to ModelBase, and more recently, TextModel and MmprojModel were introduced. Following the current documentation now leads to an AttributeError.

This PR updates the example to use @ModelBase.register("MyModelForCausalLM") and class MyModel(ModelBase), bringing the documentation back in line with the current code.

Because TextModel and MmprojModel were added, some of the methods that need to be overridden in a new model class have also changed — this PR does not address those changes.

If you guys don't mind. I plan to submit a follow‑up PR that updates the override instructions accordingly.

It’s a small fix that should prevent confusion for new contributors, and I intend to continue improving the HOWTO in subsequent PRs. Thank you for your time and consideration.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jul 25, 2025
@ggerganov ggerganov requested a review from CISC July 25, 2025 11:52
Copy link
Collaborator

@CISC CISC left a comment

Choose a reason for hiding this comment

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

Thanks for noticing and taking the time to clean this up! :)

@wooksong wooksong force-pushed the fix-typo-how-to-add-model branch from aecbeb6 to 8a35e33 Compare July 25, 2025 13:27
This patch updates the example in docs/development/HOWTO-add-model.md to
reflect recent changes after `TextModel` and `MmprojModel` were introduced.

It replaces the outdated `Model` base class with `TextModel` or `MmprojModel`
and updates the registration example accordingly.

Signed-off-by: Wook Song <[email protected]>
@wooksong wooksong force-pushed the fix-typo-how-to-add-model branch from 8a35e33 to 0ab7123 Compare July 25, 2025 13:44
@CISC CISC merged commit e7fecba into ggml-org:master Jul 25, 2025
2 checks passed
gabe-l-hart added a commit to gabe-l-hart/llama.cpp that referenced this pull request Jul 25, 2025
* origin/master:
docs : update HOWTO‑add‑model.md for ModelBase and new model classes (ggml-org#14874)
ggml : remove invalid portPos specifiers from dot files (ggml-org#14838)
context : restore preemptive sched reset when LLAMA_SET_ROWS=0 (ggml-org#14870)
mtmd : fix 32-bit narrowing issue in export-lora and mtmd clip (ggml-org#14503)
rpc : check for null buffers in get/set/copy tensor endpoints (ggml-org#14868)
sched : fix multiple evaluations of the same graph with pipeline parallelism (ggml-org#14855)
musa: upgrade musa sdk to rc4.2.0 (ggml-org#14498)
sync : ggml
cmake : fix usage issues (ggml/1257)
ggml-cpu : remove stdlib include from repack.cpp (ggml/1276)
context : perform output reorder lazily upon access after sync (ggml-org#14853)
chat : fix kimi-k2 chat template (ggml-org#14852)
sycl: fixed semantics of block offset calculation (ggml-org#14814)
llama : fix MiniCPM inference after Granite Four changes (ggml-org#14850)
docs: add libcurl-dev install hint for Linux distros (ggml-org#14801)
metal : fix fusion across different encoders (ggml-org#14849)
sycl: fix undefined variable in work group size check (ggml-org#14843)
convert : text-only support for GLM-4.1V-9B-Thinking (ggml-org#14823)
CUDA: fix overflow in FA, tune performance (ggml-org#14840)
CUDA: fix compilation with GGML_CUDA_F16 (ggml-org#14837)
@wooksong wooksong deleted the fix-typo-how-to-add-model branch July 25, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants