Add cache and offload support for TracInAttributor#257
Open
brightXian wants to merge 3 commits intoTRAIS-Lab:mainfrom
Open
Add cache and offload support for TracInAttributor#257brightXian wants to merge 3 commits intoTRAIS-Lab:mainfrom
brightXian wants to merge 3 commits intoTRAIS-Lab:mainfrom
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.
Description
1. Motivation and Context
Implements cache + offload for
TracInAttributoras discussed in #255.2. Summary of the change
Added
offloadparameter with three modes:"none"(in-memory),"cpu","disk". Reuses existing offload manager fromblock_projected_if.Also changed
attribute(train, test)→attribute(test, train=None)to support the cached path. All existing callers updated.Benchmark
Here is a simple benchmark on MNIST LR, 10k train / 2k test, batch 100, 2 checkpoints, CUDA, projector dim 512. All three cache modes match no-cache baseline.
The speedup comes from avoiding redundant train gradient recomputation.
"none"is fastest by concatenating all cached grads for a single matmul;"cpu"/"disk"trade speed for lower memory by retrieving batch-by-batch.3. Tests
test_tracinandtest_tracin_proj