Class LoraAdapterConverter
- Namespace
- LMKit.Finetuning
- Assembly
- LM-Kit.NET.dll
Converts a PEFT LoRA adapter (an adapter_model.safetensors plus its
adapter_config.json, the layout the Hugging Face ecosystem trains and
publishes) into the GGUF adapter format the inference engine loads. The
conversion is fully managed: the safetensors container is parsed directly,
tensor names are mapped from their Hugging Face module paths onto the engine's
tensor names, weights are widened to 32-bit floats, and a GGUF v3 adapter file
is written carrying the metadata the engine's loader requires
(general.type, adapter.type, adapter.lora.alpha, and the
base model's architecture).
public static class LoraAdapterConverter
- Inheritance
-
LoraAdapterConverter
- Inherited Members
Remarks
The name mapping covers the transformer module paths shared by the llama-family architectures (attention and feed-forward projections, token embeddings, and the output head). An adapter that targets a module outside this set, or a non-LoRA method such as DoRA, is refused with the offending name so the caller can report it instead of producing an adapter that would silently drop tensors.
Methods
- ConvertPeftToGguf(string, string, string, string)
Converts a PEFT LoRA adapter to a GGUF adapter file.
- LooksLikeSafetensors(string)
Whether a file looks like a safetensors container: a plausible little-endian header length followed by a JSON object.