Skip to content

Commit 7408430

Browse files
committed
[vllm] docstring update
1 parent dee43cf commit 7408430

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

examples/vllm_inference.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ def main():
3737
pipeline_name=pipeline_name, model_args=model_args, data_args=data_args, pipeline_args=pipeline_args
3838
)
3939

40+
# `release_gpu=True` does an in-process best-effort cleanup; it is
41+
# sufficient for this standalone example. For colocated training+inference
42+
# (e.g. iterative DPO) or tensor_parallel_size > 1, prefer
43+
# `MemorySafeVLLMInferencer` instead.
4044
res = inferencer.inference(
4145
model,
4246
dataset,

src/lmflow/models/hf_model_mixin.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,18 +559,21 @@ def deactivate_model_for_inference(
559559
):
560560
"""Deactivate the model and release the resources.
561561
562-
NOTE: Currently, VLLM doesn't have an official way to do this, and the
563-
implementation below cannot release all gpu resources by our observation.
564-
Thus this method is just a placeholder for future implementation. See:
565-
[Github issue](https://github.com/vllm-project/vllm/issues/1908)
562+
NOTE: For vllm (>=0.8), the best-effort release below works for most
563+
single-GPU, inference-only use cases. It remains unreliable when
564+
``tensor_parallel_size > 1``, CUDA graphs are enabled, or the same
565+
process also holds an HF training model — in those cases use
566+
:class:`MemorySafeVLLMInferencer`, which isolates inference in a
567+
subprocess. vllm still has no official in-process shutdown API
568+
(RFC vllm-project/vllm#24885); ``MemorySafeVLLMInferencer`` is kept
569+
for backward compatibility and will be migrated to vllm sleep mode
570+
in a follow-up.
566571
"""
567572
if not self._activated:
568573
logger.warning("You are trying to deactivate the model for inference, but it is already deactivated.")
569574
return
570575

571576
if inference_engine == "vllm":
572-
# vllm still cannot fully release GPU memory in-process.
573-
# See: https://github.com/vllm-project/vllm/issues/1908
574577
try:
575578
from vllm.distributed.parallel_state import destroy_model_parallel
576579
destroy_model_parallel()

0 commit comments

Comments
 (0)