class
Llama::AdapterLora
- Llama::AdapterLora
- Reference
- Object
Overview
Wrapper for the llama_adapter_lora structure
This class represents a LoRA (Low-Rank Adaptation) adapter that can be applied to a model to modify its behavior without changing the original weights.
Defined in:
llama/adapter_lora.crllama/adapter_lora/error.cr
Constructors
-
.new(model : Model, path : String)
Creates a new LoRA adapter from a file
Instance Method Summary
-
#finalize
Frees the resources associated with this adapter
-
#free : Nil
Releases the underlying C resources
-
#model : Model
Returns the model this adapter was loaded for.
-
#to_unsafe : Pointer(Llama::LibLlama::LlamaAdapterLora)
Returns the raw pointer to the underlying llama_adapter_lora structure
Constructor Detail
Creates a new LoRA adapter from a file
Parameters:
- model: The Model to load the adapter for
- path: Path to the LoRA adapter file
Raises:
- Llama::AdapterLora::Error if the adapter cannot be loaded
Instance Method Detail
Releases the underlying C resources
Calling this method multiple times is safe; only the first call releases the resources. The finalizer also calls this method, so manual calls are only needed to release resources deterministically, for example before process exit.
Returns the raw pointer to the underlying llama_adapter_lora structure