llama_lora_apply: Apply a LoRA adapter to context

View source: R/llama.R

llama_lora_applyR Documentation

Apply a LoRA adapter to context

Description

Activates a loaded LoRA adapter for the given context. Multiple LoRA adapters can be applied simultaneously.

Usage

llama_lora_apply(ctx, lora, scale = 1)

Arguments

ctx

Context handle returned by [llama_new_context]

lora

LoRA adapter handle from [llama_lora_load]

scale

Scaling factor for the adapter (1.0 = full effect, 0.5 = half effect)

Value

No return value, called for side effects. Activates the LoRA adapter for the given context.

Examples

## Not run: 
model <- llama_load_model("base-model.gguf")
lora <- llama_lora_load(model, "adapter.gguf")
ctx <- llama_new_context(model)

# Apply with full strength
llama_lora_apply(ctx, lora, scale = 1.0)

# Or apply with reduced effect
llama_lora_apply(ctx, lora, scale = 0.5)

## End(Not run)

llamaR documentation built on May 28, 2026, 1:06 a.m.