Skip to content

Split forgelm/trainer.py into a sub-package (_kwargs, _runtime, _finalize, _artifacts) — deferred until Phase 16 S4 and S8 have landed #904

Open

Description

@cemililik

Deferred work · F-PR29-A1-05: trainer.py · severity Low · cost ~1 day · recorded in docs/roadmap/risks-and-decisions.md:79

Summary

forgelm/trainer.py is a deferred module split: the ForgeTrainer god-object holds TRL kwarg fold-in, OOM/DeepSpeed runtime, artifact finalisation and the compliance / model-card / deployer hand-off in one file; forgelm.trainer.ForgeTrainer and forgelm.trainer.train must stay importable. The module-size guard holds it to a fatal no-growth budget, but nothing pays the debt down until someone takes the split.

Condition or budget

Phase 16 S2, S3, S4 and S8 have all landed (decision C-18: never split ahead of the behaviour steps that change the same file); S4 is #890 and S8 is #894

State today (re-checked 2026-10-09)

1519 code lines against a budget of 1519 at 08f2426 (deferred at 1432, raised five times); no forgelm/trainer/ package exists.

Related

#667 and #668 track how the module-size guard counts lines and accepts budget raises; decide them before relying on a module's budget.

Acceptance criteria

  • The module becomes a sub-package along the recorded seams, behaviour-neutral, with every public name still importable from its current path.
  • Its _DEFERRED_SPLITS entry is removed from tools/check_module_size.py and every resulting module is under the normal ceiling.
  • Test patch targets that named the old module are retargeted to the module that resolves the name at call time (the forgelm/verify.py split found five that silently moved).
  • The row is removed from the deferral table and the CHANGELOG names its ID (the table's removal contract).

Recorded in docs/roadmap/risks-and-decisions.md (read at f94595f) and re-checked against the code on 2026-10-09. The row leaves that table only when the fix is on main, the CHANGELOG names its ID and any promised guard exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: trainerCode area: trainerblockedWaits for another issue (see Blocked by); set and removed automatically, never by handdeferredDeferred with a recorded condition: check that it holds before startingseverity: lowMinor defect, inaccuracy or rough edgesource: roadmapPlanned or deferred work recorded in docs/roadmap/wave: 4Roadmap wave 4: low / info / watch, when touching the module

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions