LoRA: Custom layer filters that support regular expressions#778
LoRA: Custom layer filters that support regular expressions#778dxqb merged 16 commits intoNerogar:masterfrom
Conversation
…efault custom filter
Nerogar
left a comment
There was a problem hiding this comment.
Using regular expressions without any additional checks looks a bit dangerous. For example, the . character has a special meaning in regular expressions but is a very common character in module names. A filter like a.b could match unintended modules, not just those that contain exactly a.b
|
- `use_regex` parameter in ModuleFilter for regex matching. - Updated LoRAModuleWrapper to use it - Added toggle for regex usage to UI - Added logging for selected and skipped layers during module creation. - Update TrainConfig to have `lora_layers_regex` attribute - UI tweaks to lora tab for layer preset.
|
Given Thomas has been MIA for awhile now I have gone and refactored it. @dxqbYD Added logging of the selected/unselected layers/ |
|
Here is now code that applies a layer filter to full tinetuning - although technically requires_grad should also set to False for these parameters |
|
one possible solution for the some of the complications above: |
|
I think that would allow filtering of “single” for the flux-ish models (flux, Hunyuan, i assume Chroma) to only grab a double block(s). |
yes. any other use cases that would really require regex? |
okay, if we want to support regex let's do that for expert users, but following the same sentiment as your screenshot quote I'd like a way to reject a pattern for non-expert users. I'd consider myself among those non-expert users, considering how difficult it is to reject something using regex:
What do you think about:
This solves the complexity, but also this #778 (comment) because we don't need regex presets anymore. |
Sumarising convo on Discord:
I believe all review comments have been addressed now or are relevant to a new PR |
4cade51 to
9c090e9
Compare


Old-style literal filters are still supported, since they are valid regular expressions, too.