Skip to content

Commit 04a487d

Browse files
committed
cleanup
Signed-off-by: Lu Fang <[email protected]>
1 parent 39f66e5 commit 04a487d

File tree

7 files changed

+1
-35
lines changed

7 files changed

+1
-35
lines changed

examples/offline_inference/torchrun_dp_example.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
generated_text = output.outputs[0].text
5454
print(f"Prompt: {prompt!r}\nGenerated text: {generated_text!r}\n")
5555
print("-" * 50)
56-
57-
del llm
5856
"""
5957
Further tips:
6058

tests/distributed/test_torchrun_example_moe.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,3 @@ def test_consistent_across_ranks(obj):
7979
test_consistent_across_ranks(generated_text)
8080
print(f"Rank {group_rank}, Prompt: {prompt!r}, "
8181
f"Generated text: {generated_text!r}")
82-
83-
del llm

vllm/compilation/backends.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,3 @@ def copy_and_call(*args):
648648
return self.split_gm(*list_args)
649649

650650
return copy_and_call
651-
652-
def __del__(self):
653-
# cleanup the backend explicitly to avoid hanging
654-
# before program exits
655-
if hasattr(self, 'split_gm'):
656-
del self.split_gm
657-
if hasattr(self, 'piecewise_graphs'):
658-
del self.piecewise_graphs

vllm/compilation/decorators.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ def _support_torch_compile(
193193
cls.__bases__ = cls.__bases__ + (TorchCompileWrapperWithCustomDispatcher, )
194194

195195
old_init = cls.__init__
196-
old_del = cls.__del__ if hasattr(cls, '__del__') else None
197196

198197
setattr(cls, IGNORE_COMPILE_KEY, False)
199198

@@ -215,17 +214,7 @@ def __init__(self, *, vllm_config: VllmConfig, prefix: str = '', **kwargs):
215214
TorchCompileWrapperWithCustomDispatcher.__init__(
216215
self, compilation_level=vllm_config.compilation_config.level)
217216

218-
def __del__(self):
219-
assert self is not None
220-
if hasattr(self, 'backend'):
221-
# cleanup the backend explicitly to avoid hanging
222-
# before program exits
223-
del self.backend
224-
if old_del is not None:
225-
old_del(self)
226-
227217
cls.__init__ = __init__
228-
cls.__del__ = __del__
229218

230219
def __call__(self, *args, **kwargs):
231220
# torch.compiler.is_compiling() means we are inside the compilation

vllm/compilation/wrapper.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def __init__(self,
3636

3737
vllm_config = get_current_vllm_config()
3838
self.vllm_config = vllm_config
39-
self.backend = None
4039
if compiled_callable is None:
4140
# default compilation settings
4241
# compiling the forward method

vllm/distributed/parallel_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ def graph_capture(device: torch.device):
10061006
"""
10071007
context = GraphCaptureContext(torch.cuda.Stream(device=device))
10081008
with get_tp_group().graph_capture(context), get_pp_group().graph_capture(
1009-
context), get_dp_group().graph_capture(context):
1009+
context):
10101010
yield context
10111011

10121012

vllm/v1/worker/gpu_model_runner.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,6 @@
117117
AttnMetadataDict]
118118

119119

120-
def explicit_cleanup_submodule(model: nn.Module):
121-
for module in model.children():
122-
if hasattr(module, "__del__") and callable(module.__del__):
123-
module.__del__()
124-
125-
126120
# Wrapper for ModelRunnerOutput to support overlapped execution.
127121
class AsyncGPUModelRunnerOutput(AsyncModelRunnerOutput):
128122

@@ -4051,7 +4045,3 @@ def _to_list(self, sampled_token_ids: torch.Tensor) -> list[list[int]]:
40514045
self.transfer_event.record()
40524046
self.transfer_event.synchronize()
40534047
return pinned.tolist()
4054-
4055-
def __del__(self):
4056-
if isinstance(self.model, nn.Module):
4057-
explicit_cleanup_submodule(self.model)

0 commit comments

Comments
 (0)