diff options
| author | CaptainJack2491 <jayrupnakawala@gmail.com> | 2026-08-29 23:32:30 +0100 |
|---|---|---|
| committer | CaptainJack2491 <jayrupnakawala@gmail.com> | 2026-08-29 23:32:30 +0100 |
| commit | 9a5912f7764dbc942b56f8114f2c878c1a6d44ff (patch) | |
| tree | 1c01d9335ffa8964e75a9206f5b439403aa3e830 /src/train.py | |
| parent | 7b0fddb02b089b82b8d12b2dcac17bf9527817da (diff) | |
optimize E8: precompute causal mask buffer, add eval early exit, and enable compile_model in e8.csv
Diffstat (limited to 'src/train.py')
| -rw-r--r-- | src/train.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/train.py b/src/train.py index 2523325..8ce5394 100644 --- a/src/train.py +++ b/src/train.py @@ -105,6 +105,9 @@ def evaluate_gpu(model, gpu_ds: dict[str, torch.Tensor | int | bool], examples: o = model(x, y_in) nxt = o["logits"][:, -1].argmax(-1) y_in = torch.cat([y_in, nxt[:, None]], dim=1) + # If all sequences in the batch have emitted at least one EOS, we can exit safely + if ((y_in[:, 1:] == cfg.eos_id).any(dim=1)).all(): + break gen = y_in[:, 1:].cpu() for i, ex in enumerate(chunk_examples): |
