refactor: deduplicate trainer and clean up load_data API - #13
marksverdhei wants to merge 1 commit into
Conversation
- Extract _prepare_inputs(), _per_sample_kl(), _validate_batch(), and
_zero_loss() from compute_loss/prediction_step to eliminate ~60 lines
of duplication
- Change load_data() to accept explicit dataset/split kwargs, removing
the type("_DC", ...) hack from cli.py
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
This is now conflicting with main after #16 (eval_dataset) and #20/#17 (pending perf PRs that also touch trainer.py) were merged/proposed. The refactoring approach is solid — deduplicating Needs a rebase onto current main to resolve conflicts, particularly in |
|
Closing — the trainer dedup is reasonable in isolation but (a) the project is pivoting away from PromptBakingTrainer toward SFT, so this polishes code that may be removed, and (b) the load_data API change introduces an awkward dual-mode signature ( |
Summary
Follow-up to #12 addressing review suggestions:
_prepare_inputs(),_per_sample_kl(),_validate_batch(), and_zero_loss()fromcompute_lossandprediction_step, eliminating ~60 lines of duplicated logicload_data()API cleanup: Accept explicitdataset/dataset_splitkwargs instead of requiring a DataConfig-like object, removing thetype("_DC", ...)hack fromcli.pyTest plan
🤖 Generated with Claude Code