Repository navigation
Conversation
KartikP
added a commit
that referenced
this pull request
Oct 15, 2026
Three plugins break against newly released third-party packages. All three failures showed up in the CI for #420. That PR edits `model_helpers`, which makes CI test every language plugin, and none of the failures involve its diff. ## Failures and fixes - **wikitext data**: the plugin requires `datasets==2.*`, which does not cap `pyarrow`. - pyarrow 26.0.0 (released 2026-10-09) raises `ImportError: pyarrow requires NumPy 2.0 or newer` against our `numpy<2` pin. - This fails `tests/test_model_helpers/test_huggingface.py::TestNextWord::test_0_dimensional_tensor` (Non-Plugins) on any PR that runs it. - Fix: pin `pyarrow<26`. - **earley_parser**: NLTK 3.10 refuses to read corpus directories that are not listed in `nltk.data.path`. - Loading the bundled treebank fails with `PermissionError: Security Violation [CorpusReader.__init__]: Unauthorized path .../earley_parser/treebank`. - Fix: add the treebank directory to `nltk.data.path` before reading it. - **lm1b**: an unpinned `tensorflow` install upgrades NumPy to 2.x. - The plugin's xarray import then fails at test collection with `AttributeError: np.unicode_ was removed in the NumPy 2.0 release`. - Fix: add `numpy<2`. ## Verification - `pyarrow==26.0.0` with `numpy==1.26.4` reproduces the ImportError. `pyarrow==25.0.1` with the same NumPy imports cleanly. - `nltk==3.10.3` reproduces the PermissionError on the bundled treebank. With the path added, all 11 trees in `sample_treebank` parse. - `pip install --dry-run` for linux x86_64 / Python 3.11: - `tensorflow` alone resolves to numpy 2.4.6, which reproduces the lm1b failure. - `tensorflow` with `numpy<2` resolves to tensorflow 2.20.0 and numpy 1.26.4. - `datasets==2.*` with `pyarrow<26` and `numpy<2` resolves to datasets 2.21.0, pyarrow 25.0.1 and numpy 1.26.4. - The model tests themselves have not been run locally. This PR touches all three plugins, so CI runs their tests. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #415.
Problem
#400 added a KV cache for behavioral-only tasks. Once the accumulated context exceeded the model's window, it sliced the oldest cache entries and kept feeding only new tokens. That is not equivalent to re-encoding the truncated window: kept keys/values still encode the dropped tokens, and absolute-position models (GPT-2, GPT-Neo, OPT) see mismatched positions. Futrell2018 scores changed for every model whose window is shorter than the corpus (~13-14k tokens).
Change
Drop the cache and recompute whenever the tokenizer truncates the context (
past + new != truncated context length). Before overflow the cache is still used; after overflow behavior matches pre-#400.Adds
test_kv_cache_matches_recompute_past_context_window: distilgpt2 past its 1024-token window, cached path vs. the no-cache path (neural recording enabled).Verification (g5.xlarge, A10G, transformers 4.57.1, torch 2.9.0)
tests/test_model_helpers/test_huggingface.py -k ReadingTimes: 7 passed.Futrell2018-pearsonr,gpt-neo-1.3B, this branch: normalized 0.323570, raw 0.277637. Matches the no-cache result reported in Futrell2018 GPT-Neo score changes at context overflow with HF sliding KV cache #415 (0.323570 / 0.277637) and the public leaderboard value (0.32).Follow-up
Scores computed with the sliding cache after #400 merged will be rescored separately: falcon-7b, gemma-2b and opt-6.7b on Futrell2018. Models with windows of 32k or more never overflow on Futrell, and the post-#400 Wikitext rows have no stored score.
Note: Futrell scoring for short-window models returns to its pre-#400 cost (about 78 min for gpt-neo-1.3B on an A10G).