bugfix(16): operators must not feed a BatchEncoding to model.generate

The transformers 5.x return-type change behind #15 also breaks generation:
apply_chat_template(add_generation_prompt=True, return_tensors="pt") returns a
BatchEncoding, and eval.py + resident.py passed it to model.generate, which does
inputs.shape[0] -> AttributeError (the holdout eval crashed on scenario 1). #15
fixed only the trainer. Factor a shared _input_ids helper and a render_prompt_ids
function; both operators use it. Tests cover _input_ids for both shapes and
render_prompt_ids.
This commit is contained in:
Tiara Rodney 2026-06-18 16:49:30 +02:00
parent d261919404
commit 1279bc8965
Signed by: tiara
GPG key ID: 5CD8EC1D46106723
5 changed files with 58 additions and 18 deletions

View file

@ -7,6 +7,18 @@ are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.2] - 2026-06-18
### Fixed
- The generation operators (`sekft-eval`, `sekft-resident`) passed the
`BatchEncoding` from `apply_chat_template(..., return_tensors="pt")` straight
to `model.generate`, which does `inputs.shape[0]` and raised `AttributeError`
on transformers ≥ 5 — the holdout eval crashed on its first scenario. 1.0.1
fixed only the trainer's masking; this sweeps the generation path too. A shared
`_input_ids` helper and a `render_prompt_ids` function now extract the id
tensor for both operators, with unit tests for the BatchEncoding and bare
shapes.
## [1.0.1] - 2026-06-18
### Fixed
@ -50,5 +62,6 @@ trajectories into a fine-tuned shell operator.
mypy-strict codebase; an optional `[gpu]` extra (torch / transformers / peft);
and a dependency on `posix-sdc[hub]`. Released under GPL-2.0.
[1.0.2]: https://git.code.tiararodney.com/tiara/sekft/compare/v1.0.1...v1.0.2
[1.0.1]: https://git.code.tiararodney.com/tiara/sekft/compare/v1.0.0...v1.0.1
[1.0.0]: https://git.code.tiararodney.com/tiara/sekft/releases/tag/v1.0.0