soup/soup_cli/trainer
Alpamys 5e0872b9ea feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67)
Extends the v0.39.0 ReLoRA callback (Part B) and surgical PEFT patches
(Part D — Gemma4 ClippableLinear swap + 3-D fused-MoE expert dropout
strip) from SFT-only to all 11 non-SFT transformer-backend trainers
(DPO, GRPO, KTO, ORPO, SimPO, IPO, PPO, RewardModel, Pretrain,
Embedding, BCO).

- New shared helper soup_cli/utils/peft_wiring.py exposes
  apply_pre_lora_patches, apply_post_lora_patches, attach_relora_callback.
- SFT migrated to the same helpers in the same release (centralisation
  invariant; no drift between SFT and non-SFT wiring).
- SoupConfig._validate_relora_supported_tasks: task != "sft" rejection
  removed; MLX backend still rejected with distinct message.

Review fixes:
- attach_relora_callback uses `if relora_steps is None:` (project
  policy) so a schema-bypassing relora_steps=0 surfaces as a loud
  ReLoRAPolicy ValueError rather than a silent skip.
- Direct attribute access on tcfg.relora_warmup_ratio / _reset_optimizer
  / _prune_ratio (Pydantic schema guarantees them); no getattr defaults.
- 11 behavioural helper tests (Gemma4 happy path + exception swallow,
  post-LoRA strip happy + exception swallow, ReLoRA policy field
  forwarding, schema-bypass loud-fail).
- Schema-gate matrix covers `task='preference'` dispatcher.

Tests: 5061 -> 5122 (+61).

Closes #67.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 15:48:17 +05:00
..
__init__.py Initial project setup: CLI skeleton + config + trainer + data pipeline 2026-02-20 16:14:56 +05:00
bco.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
dpo.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
embedding.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
grpo.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
ipo.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
kto.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
mlx_dpo.py feat(v0.25.0): Beyond the Wrapper — 8 major features 2026-04-13 12:58:11 +05:00
mlx_grpo.py feat(v0.25.0): Beyond the Wrapper — 8 major features 2026-04-13 12:58:11 +05:00
mlx_routing.py feat(v0.25.0): Beyond the Wrapper — 8 major features 2026-04-13 12:58:11 +05:00
mlx_sft.py feat(v0.25.0): Beyond the Wrapper — 8 major features 2026-04-13 12:58:11 +05:00
orpo.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
ppo.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
preference.py feat(security): trust_remote_code opt-in across non-SFT trainers + 5 commands (v0.40.4 Part A) 2026-05-09 13:20:13 +05:00
pretrain.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
reward_model.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
rewards.py fix(v0.33.0): review-wave findings (CRITICAL + HIGH + MEDIUM + LOW) 2026-04-27 19:57:57 +05:00
sft.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00
simpo.py feat(trainer): ReLoRA + surgical PEFT non-SFT (v0.40.6 #67) 2026-05-09 15:48:17 +05:00