Conversation
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
HDCharles
reviewed
Jan 8, 2026
HDCharles
reviewed
Jan 8, 2026
Collaborator
brian-dellabetta
left a comment
There was a problem hiding this comment.
Impressive work! I would like to better understand some of the logic in src/compressed_tensors/offload/dispatch.py, but leaving some additional comments for now
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Collaborator
brian-dellabetta
left a comment
There was a problem hiding this comment.
sorry forgot to submit this comment previously
HDCharles
reviewed
Jan 12, 2026
HDCharles
reviewed
Jan 12, 2026
5 tasks
brian-dellabetta
previously approved these changes
Jan 12, 2026
HDCharles
reviewed
Jan 12, 2026
HDCharles
reviewed
Jan 12, 2026
HDCharles
previously approved these changes
Jan 12, 2026
Collaborator
HDCharles
left a comment
There was a problem hiding this comment.
see comments but overall looks good
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
3d30bdf
brian-dellabetta
approved these changes
Jan 13, 2026
HDCharles
approved these changes
Jan 21, 2026
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.
Purpose
module.weightattributes directly are not compatible with accelerate's offloading, as used by the sequential pipelinePrerequisites
Implementation Design
OffloadCache
The core of the offloading implementation is the
OffloadCache.When offloading a module, the module's
_parameterand_bufferprivate attributes are replaced with instances of theOffloadCache. TheOffloadCacheinstance acts like a dictionary where assigned tensors are offloaded and retrieved tensors are onloaded. The original (now offloaded) tensors are stored in theoffloaded_valuesvariable.While in the
disable_offloadingcontext, a strong reference to the tensors is maintained bykeep_onloaded_values, which results in cache hits if a tensor is retrieved more than once within the context. Upon exiting the context, these strong references are dropped.CPUCache
Different offload types need only to implement a subclass of
OffloadCacheand specify definitions for onloading a tensor and offloading a tensor, the two methods being inverses of one another.Dispatch Functions
There are two dispatch functions.
offload_modeloffloads a model in a style most useful for sequential onloading, anddispatch_modeloffloads a model in a style most useful for autoregression generation.Limitations
disable_offloadingcontext at a time, which is true for single-threaded applications.update_offload_parameter, this implementation also supports direct parameter assignment, so no existing code needs to be changed.Testing
tests/test_offload