ls_mlkit.util.lora module

ls_mlkit.util.lora.find_linear_modules(model) List[str][source]

Find the linear modules in a model

Parameters:

model (torch.nn.Module) – the model to find the linear modules

Returns:

the names of the linear modules

Return type:

List[str]

ls_mlkit.util.lora.get_lora_model(model, lora_config)[source]

Get a LoRA model

Parameters:
  • model (torch.nn.Module) – the model to get the LoRA model

  • lora_config (LoraConfig) – the LoRA configuration

Returns:

the LoRA model

Return type:

torch.nn.Module