Skip to content

CI check for NandhaKishorM/laya#899 (do not merge) - #1

Open
GuilhermeFusari wants to merge 1 commit into
mainfrom
feat/train-module
Open

GuilhermeFusari wants to merge 1 commit into
mainfrom
feat/train-module

Conversation

@GuilhermeFusari

Copy link
Copy Markdown
Owner

Runs the repository's CI on the branch of NandhaKishorM#899 inside this fork, because workflows on the upstream PR wait for maintainer approval. Not meant to be merged.

…d scripts to share

The training loop lives in three drifting copies (the Kaggle notebook, the MPS script and
research/scripts/finetune_single_device.py). This adds it to the package once, as the first
step of NandhaKishorM#887. TrainConfig() trains the way the published notebook does: loss="rlcd", options
in their listed order, and an effective batch of 64 (micro_batch=8 x grad_accum=8).

- loss="soft-ce" trains on the soft cross-entropy alone (the variant NandhaKishorM#741 tested).
- shuffle_options re-encodes items of the named types with a random option_order each epoch,
  through the same path inference uses, and permutes the target to match. Off by default.
- Questions go through Agent._check_question and Agent._to_internal, so training sees the
  option text inference shows (list-form choices, custom noul labels, non-string instructions).
- Calibration uses laya.calibrate.fit_temperature_map, so the fit follows the runtime clamp and
  buckets; an inherited temperature_by_options is dropped unless refitted.
- Questions that cannot be trained on are skipped and counted by reason (invalid_question,
  invalid_target, target_mismatch, options_collapsed per NandhaKishorM#538).
- The max_len / head_max_len used in training are written into the saved config, with the
  TrainConfig under training.laya_train.
- freeze_encoder trains the head only and keeps the encoder in eval mode.

The existing scripts are left untouched in this change; NandhaKishorM#851 and NandhaKishorM#885 are open against them.
tests/test_train.py is weight-free (one-layer BERT, word-level tokenizer, no downloads) and is
registered in the shared suite list and the Windows CI loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread tests/test_train.py
cls.tok = make_tokenizer()
make_checkpoint(cls.root / "base", cls.tok)
cls.data = cls.root / "train.jsonl"
cls.data.write_text("\n".join(json.dumps(r) for r in rows()), encoding="utf-8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants