Skip to content

Commit dc77c63

Browse files
authored
fix: fastmoe lora all-linear excluding router (#545)
* fix: all-linear passed through CLI Signed-off-by: Will Johnson <[email protected]> * fmt Signed-off-by: Will Johnson <[email protected]> * fix: exclude router module Signed-off-by: Will Johnson <[email protected]> * don't exclude Signed-off-by: Will Johnson <[email protected]> * warning update Signed-off-by: Will Johnson <[email protected]> * fix: more specific warning Signed-off-by: Will Johnson <[email protected]> --------- Signed-off-by: Will Johnson <[email protected]>
1 parent cad6ed8 commit dc77c63

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

tuning/sft_trainer.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,24 +170,14 @@ def train(
170170
if fast_moe_config is not None and fast_moe_config.fast_moe is None:
171171
fast_moe_config = None
172172
if fast_moe_config is not None:
173-
# Checking for unsupported modules with Scatter MoE for LoRA
174-
# Only raise an error for `all-linear`
175-
restricted_modules = ["all-linear"]
173+
# If LoRA with ScatterMoE detected, raise warning
174+
accepted_layers = ["all-linear"]
176175
if (
177176
peft_config is not None
178177
and hasattr(peft_config, "target_modules")
179-
and any(
180-
module in (peft_config.target_modules or [])
181-
for module in restricted_modules
182-
)
178+
and fast_moe_config.fast_moe is not None
179+
and peft_config.target_modules != accepted_layers
183180
):
184-
raise ValueError(
185-
"`--fast_moe` with LoRA does not currently support `all-linear`, as "
186-
"target modules at this time. Please explicitly specify target "
187-
"modules when using `--fast_moe` with LoRA."
188-
)
189-
# If other common non-linear modules, raise warning
190-
if peft_config is not None and hasattr(peft_config, "target_modules"):
191181
logger.warning(
192182
"You are running lora with the ScatterMoE plugin, please note that "
193183
"passing target modules that are part of the moe module can cause unexpected "

0 commit comments

Comments
 (0)