MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / _apply_lora_adapters

Method _apply_lora_adapters

examples/server/server.py:11791–11803  ·  view source on GitHub ↗
(self, ctx: Any, context_name: str)

Source from the content-addressed store, hash-verified

11789 )
11790
11791 def _apply_lora_adapters(self, ctx: Any, context_name: str) -> None:
11792 if not self._lora_adapters:
11793 return
11794 if self._lora_adapter_array is None or self._lora_scales_array is None:
11795 raise RuntimeError("LoRA adapter arrays are not initialized")
11796 result = llama_cpp.llama_set_adapters_lora(
11797 ctx,
11798 self._lora_adapter_array,
11799 len(self._lora_adapters),
11800 self._lora_scales_array,
11801 )
11802 if result:
11803 raise RuntimeError(f"failed to apply LoRA adapters to {context_name} context")
11804
11805 def _free_lora_adapters(self) -> None:
11806 while self._lora_adapters:

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected