Preserve identity-distinct autograd views in StreamingAttentionKLDivergenceReducer and add SSHR integration test - #262
Open
stephandooper wants to merge 1 commit into
Conversation
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.
Motivation
AttentionKLDivergenceReducerpassthrough) so reducer head resolution can disambiguate repeated tensor occurrences in flattened outputs.Description
StreamingAttentionKLDivergenceReducer.forwardto return identity-distinct views usingview_as, store the pair in_last_inputs, set_last_outputto the student view, and return the pair; no cloning or detaching is performed. (file updated:lightstream/core/reducer/kl.py).SSHRReducerLayoutNetand a regressiontest_sshr_layout_maps_kl_reducers_to_primary_occurrencesthat builds the flattened outputs and asserts KL reducer head indices and output shapes. (file updated:tests/test_scnn.py)._resolve_reducer_head_mapcan map reducers to their primary occurrences instead of earlier auxiliary occurrences.Testing
StreamingAttentionKLDivergenceReducer, asserted the returned views are distinct objects, verified_last_inputs/_last_output, and confirmed gradients propagated through the original tensors; this check passed.python -m compileall -q lightstream tests/test_scnn.pywhich succeeded.tests/test_scnn.py::test_sshr_layout_maps_kl_reducers_to_primary_occurrenceswhich exercised the new integration test, but it failed in this environment due to absence of an NVIDIA driver (CUDA initialization error) despite attempting to run with CPU/statistics settings; the failure is environmental rather than indicating a logic regression.Codex Task