Skip to content

Commit cb965c9

Browse files
committed
docstring
Signed-off-by: Kyle Sayers <[email protected]>
1 parent 2d87993 commit cb965c9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/llmcompressor/utils/dev.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ def patch_transformers_logger_level(level: int = logging.ERROR):
116116

117117

118118
def dispatch_for_generation(model: PreTrainedModel) -> PreTrainedModel:
119+
"""
120+
Dispatch a model autoregressive generation. This means that modules are dispatched
121+
evenly across avaiable devices and kept onloaded if possible. Removes any HF hooks
122+
that may have existed previously.
123+
124+
:param model: model to dispatch
125+
:return: model which is dispatched
126+
"""
119127
remove_hook_from_module(model, recurse=True)
120128
max_memory = get_balanced_memory(
121129
model,

0 commit comments

Comments
 (0)