Skip to content

fix(stream): cap FileReader measure reads by rotary context - #27

Open
kevin9327 wants to merge 1 commit into
volotat:mainfrom
kevin9327:fix/file-reader-measure-context-cap
Open

kevin9327 wants to merge 1 commit into
volotat:mainfrom
kevin9327:fix/file-reader-measure-context-cap

Conversation

@kevin9327

Copy link
Copy Markdown

Summary

FileReader._measure (held-out / learn=False) forwarded min(chunk, remaining) tokens starting at rotary offset 0. Training already windows each step to context. When --chunk is larger than model.context_end, the first evaluation read exceeds the rope tables and raises (reading at position N but the rotary tables were built to M).

Cap each measure read with min(n, context - seen) after the cache reset, matching the model ceiling.

Test plan

  • pytest tests/test_file_reader_measure_context.py ? fails on main (ValueError: reading at position 64 but the rotary tables were built to 16); passes with this fix (2 tests)
  • Verified by temporarily restoring the uncapped body (red) then re-applying the cap (green)

Fixes #18.

@kevin9327
kevin9327 force-pushed the fix/file-reader-measure-context-cap branch from 37af17e to fe830cd Compare October 5, 2026 07:38
Evaluation used the full --chunk length from position 0. When chunk is
larger than model.context_end, that walk past the rope tables and raises.
Training already windows to context; measure now does the same.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant