Skip to content

armgit / Soup

Public Imported from GitHub
0

Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.

2.3 KB
Raw Blame
  • moe_lora: true keeps a string target_modules and adds the MoE targets on top of it, as it already did for a list. resolve_moe_lora_targets merged the MoE names into a list target (#1590) but replaced a string with the MoE list (q_proj, k_proj, v_proj, o_proj and the expert FFN names) plus the fused expert parameters, and a string means something to peft. "all-linear", which target_modules: auto resolves to on qwen4_exp, adapts every linear layer but the output head, so a qwen4_exp base with moe_lora lost the Gated DeltaNet in_proj_qkv / in_proj_z / in_proj_a / in_proj_b / out_proj, the QSA indexer's index_qk_proj, the hyper-connection mixers and the PLE key_proj / value_proj: 10 adapted modules on a tiny two-layer model, where 32 now attach. Any other string is a regex peft full-matches against each module name, and it was dropped outright. Now "all-linear" (in any casing peft accepts) is kept as it is, since it already reaches every module the MoE names reach, and only the fused expert parameters are added. A regex becomes one regex, (?:<your regex>)|(?:<the MoE names>), so peft adapts exactly what either half matches; a leading global flag such as (?i) stays with your half, and a regex that does not compile is refused at setup, naming training.lora.target_modules. Under moe_lora a string never adapts a MoE router or shared-expert gate (a module whose output is routing logits, found from the model's structure, DBRX's and JetMoE's wrapped routers included), even one your regex names: they go to peft's exclude_modules. Only where peft would still adapt a router weight with them excluded does the string become an explicit list of what it means without them: all-linear on the families peft converts from the transformers-4 layout (qwen3_moe, deepseek_v3, ...), where peft adds the router to it as a parameter exclude_modules does not reach, a regex reaching a non-router named gate there, and VeRA, whose config has no exclude_modules. To adapt a router, name it in an explicit list. A regex that matches no module is warned about. The ScatterMoE LoRA: setup line says which of these happened. Lists are unchanged, and so is every run without moe_lora. This applies to every resident trainer and, since #2072 hands it the streaming setup's resolved targets, to layer streaming. (#2095)