Skip to content

Conversation

@chimezie
Copy link

@chimezie chimezie commented Jun 11, 2025

Adds support for matching layers to convert to LoRa by REGEX patterns:

lora_parameters:
  key_patterns: [".+gate_proj.*", ".+down_proj.+", ".+up_proj.+", ".+(q|v|k|o)_proj.+"]

Or by specifying "all" in any of the keys to indicate converting all linear layers to LoRa:

lora_parameters:
  keys: ["all"]

In either case, the keys of the converted layers are also printed for reference.

chimezie added 7 commits June 10, 2025 19:44
Introduce `should_convert_to_lora` to generalize deciding whether or not to convert a layer to LoRA.
It is used by `linear_to_lora_layers`, which is updated to indicate all linear layers are converted
if any of the keys are "all".  Otherwise, the layers indicated by their keys are converted to LoRa
Print converted layers if matched by key_patterns or "all"
@chimezie chimezie changed the title Identifying layers to convert to LoRA by patterns or indicating all linear layers Identifying layers to convert to LoRA by pattern or indicating all linear layers Jun 11, 2025
@ivanfioravanti
Copy link
Contributor

Nice one!!!

Copy link
Member

@angeloskath angeloskath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice! I left a few beautification comments and one bug but after that we can merge.

@chimezie chimezie requested a review from angeloskath June 17, 2025 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants