MCPcopy Create free account
hub / github.com/InternLM/lmdeploy / close

Method close

lmdeploy/pytorch/engine/engine.py:594–603  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

592 self._loop_finally()
593
594 def close(self):
595 if self.executor.device_type == 'cuda':
596 # https://discuss.pytorch.org/t/how-to-delete-a-tensor-in-gpu-to-free-up-memory/48879/32
597 # W/O this, repeatedly rebuilding and destroying engines within the same process
598 # will cause more and more reserved CUDA memory.
599 torch._C._cuda_clearCublasWorkspaces()
600 if self._loop_main is not None:
601 self._loop_main.cancel()
602 else:
603 self._loop_finally()
604
605 def start(self):
606 """Start engine loop tasks."""

Callers 5

load_bytesMethod · 0.45
load_bytesMethod · 0.45
load_bytesMethod · 0.45
mainFunction · 0.45
zmq_disconnectMethod · 0.45

Calls 2

_loop_finallyMethod · 0.95
cancelMethod · 0.45

Tested by

no test coverage detected