soup/soup_cli/trainer
Alpamys 3ab36e2aad feat(security): trust_remote_code opt-in across non-SFT trainers + 5 commands (v0.40.4 Part A)
Closes the v0.36.0 #63 known gap. Every non-SFT trainer wrapper (DPO /
GRPO / KTO / ORPO / SimPO / IPO / PPO / RewardModel / Pretrain /
Embedding / BCO + the unified Preference dispatcher) now accepts
trust_remote_code: bool = False on __init__, resolves once via the
v0.36.0 helper (model_requires_trust_remote_code +
resolve_trust_remote_code), and stores the resolved value on
self._trust_remote_code. Every from_pretrained call site reads from
the resolved attribute — no remaining trust_remote_code=True literal
in any trainer file (asserted by tests/test_v0404_part_a.py).

Five standalone commands gain a --trust-remote-code Typer flag with
the same default-deny + KNOWN_SAFE_PREFIXES allowlist behaviour as
soup train: soup diff, soup export, soup merge, soup infer,
soup data generate.

commands/train.py removes the v0.36.0 sft_kwargs split — every trainer
receives trust_remote_code from the same trainer_kwargs dict.

PreferenceTrainerWrapper forwards the raw bool to the inner DPO /
SimPO / ORPO / IPO / BCO wrapper kwargs at both _build_inner and
_build_multi_objective sites; the resolver fires inside the inner
wrapper at construction time.

_load_reward_model (module-level helper in ppo.py) accepts a
trust_remote_code: bool parameter and resolves internally — design
intent is that the helper is independently safe to call outside
PPOTrainerWrapper.

_export_onnx / _export_tensorrt / _export_awq / _export_gptq and
_merge_adapter helpers all gain a trust_remote_code: bool = False
parameter threaded from the Typer flag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 13:20:13 +05:00
..
__init__.py Initial project setup: CLI skeleton + config + trainer + data pipeline 2026-02-20 16:14:56 +05:00
bco.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
dpo.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
embedding.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
grpo.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
ipo.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
kto.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
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(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
ppo.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
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(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
reward_model.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
rewards.py fix(v0.33.0): review-wave findings (CRITICAL + HIGH + MEDIUM + LOW) 2026-04-27 19:57:57 +05:00
sft.py feat(v0.40.3): Stub-to-live wave 1 (#33, #64; #65 still deferred) 2026-05-08 16:02:45 +05:00
simpo.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