pub struct LlamaLoraAdapter<'model> { /* private fields */ }Expand description
A safe wrapper around llama_lora_adapter.
The adapter is initialized from a GGUF file via
crate::model::LlamaModel::lora_adapter_init.
§Ownership
In ik_llama.cpp the adapter is owned by the model: it registers itself
with the model on init and is freed automatically when the model is freed
(llama.h: “will be freed when the model is deleted”). This type therefore
has no Drop — freeing it here would double-free (once here, once by the
model).
The 'model lifetime ties the adapter to the crate::model::LlamaModel it
was built from, so the compiler enforces that the model outlives the adapter
(using an adapter after its model drops would be a use-after-free, since the
model frees it). This is stricter than the llama-cpp-2 anchor, whose
adapter carries no lifetime — a deliberate divergence for compile-time safety.
Do not use an adapter after lora_adapter_clear.