Repository navigation
Prep for release v4.2.0 – Contribution follow ups - #1875
Merged
Merged
Conversation
…ponents, and adding a few new tests for the new features.
6 of 7 tasks
abhishekcpp007
added a commit
to abhishekcpp007/TransformerLens
that referenced
this pull request
Nov 4, 2026
…_results stack_neuron_results got a guard in TransformerLensOrg#1875: with incl_remainder=True, a layer below 0 raises, because range(layer) is empty and the remainder reads resid_post[layer - 1], which __getitem__ wraps to a late layer. stack_head_results has the same code path and never got the guard. On a 4-layer model stack_head_results(-2, incl_remainder=True) returns one component labelled "remainder" that is resid_post[1], with no error. On a 2-layer model the same call fails with a KeyError on blocks.-1.hook_resid_post instead of the sibling's ValueError. Raise the same ValueError as the neuron stack. layer=0 stays valid and still returns the whole final residual stream, and incl_remainder=False is unchanged.
5 tasks done
jlarson4
added a commit
that referenced
this pull request
Nov 6, 2026
…_results (#1976) * fixing slow tests (#1877) * fix(ActivationCache): reject a negative remainder layer in stack_head_results stack_neuron_results got a guard in #1875: with incl_remainder=True, a layer below 0 raises, because range(layer) is empty and the remainder reads resid_post[layer - 1], which __getitem__ wraps to a late layer. stack_head_results has the same code path and never got the guard. On a 4-layer model stack_head_results(-2, incl_remainder=True) returns one component labelled "remainder" that is resid_post[1], with no error. On a 2-layer model the same call fails with a KeyError on blocks.-1.hook_resid_post instead of the sibling's ValueError. Raise the same ValueError as the neuron stack. layer=0 stays valid and still returns the whole final residual stream, and incl_remainder=False is unchanged. --------- Co-authored-by: Jonah Larson <jonahalarson@comcast.net>
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.
Description
Ensuring any edge cases introduced by new contributions are addressed. Primarily adding additional layers of testing trying to ensure components are properly covered.
Type of change
Checklist: