Table of Contents

Class LoraMerger

Namespace
LMKit.Finetuning
Assembly
LM-Kit.NET.dll

Handles the merging of Low-Rank Adaptation (LoRA) transformations into a base model.
This class is responsible for loading LoRA transformation files and integrating them with a base model's weights.

public sealed class LoraMerger
Inheritance
LoraMerger
Inherited Members

Constructors

LoraMerger(LLM)

Initializes a new instance of the LoraMerger class using an existing LLM object.

LoraMerger(string)

Initializes a new instance of the LoraMerger class with a specified base model file path.

Properties

ThreadCount

Gets or sets the number of threads to be used for the merging process.
Ensures that the thread count is always at least 1 to prevent invalid configurations.

Methods

AddLoraAdapter(LoraAdapterSource)

Adds a LoRA (Low-Rank Adaptation) transformation to the internal list of adapters using the specified file.

AddLoraAdapter(string, float)

Adds a LoRA (Low-Rank Adaptation) transformation to the internal list of adapters using the specified file path and scale factor.

ClearAdapters()

Clears all previously added LoRA (Low-Rank Adaptation) adapters from the internal list.

Merge(string, MetadataCollection)

Merges the currently loaded LoRA (Low-Rank Adaptation) transformations into the base model and saves the result to the specified destination file path.
This operation combines the base model with the applied LoRA adapters, allowing for efficient fine-tuning of the model.