Skip to content

Commit

Permalink
add docstring
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
  • Loading branch information
kylesayrs committed Dec 16, 2024
1 parent 870095e commit 77411ca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/compressed_tensors/utils/offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,17 @@ def offload_to_weights_map(
value: torch.Tensor,
default_device: torch.device = torch.device("cpu"),
):
"""
Helper function which implements offloaded item assignment for PrefixedDataset,
OffloadedWeightsLoader, and Dict types.
:param weights_map: weight map to be updated with offload information
:param key: key used to identify weight location
:param value: weight being offloaded
:param default_device: in the event that the weights_map does already contain
offloaded weights or use disk offloading, the weight will be offloaded to the
`default_device`
"""
if isinstance(weights_map, PrefixedDataset):
dataset = weights_map.dataset
key = f"{weights_map.prefix}{key}"
Expand Down

0 comments on commit 77411ca

Please sign in to comment.