MCPcopy Create free account
hub / github.com/Tencent/digitalhuman / sleep

Method sleep

RLVER/code/llm.py:1239–1259  ·  view source on GitHub ↗

Put the engine to sleep. The engine should not process any requests. The caller should guarantee that no requests are being processed during the sleep period, before `wake_up` is called. Args: level: The sleep level. Level 1 sleep will offload the model

(self, level: int = 1)

Source from the content-addressed store, hash-verified

1237 return self.llm_engine.reset_prefix_cache(device)
1238
1239 def sleep(self, level: int = 1):
1240 """
1241 Put the engine to sleep. The engine should not process any requests.
1242 The caller should guarantee that no requests are being processed
1243 during the sleep period, before `wake_up` is called.
1244
1245 Args:
1246 level: The sleep level. Level 1 sleep will offload the model
1247 weights and discard the kv cache. The content of kv cache
1248 is forgotten. Level 1 sleep is good for sleeping and waking
1249 up the engine to run the same model again. The model weights
1250 are backed up in CPU memory. Please make sure there's enough
1251 CPU memory to store the model weights. Level 2 sleep will
1252 discard both the model weights and the kv cache. The content
1253 of both the model weights and kv cache is forgotten. Level 2
1254 sleep is good for sleeping and waking up the engine to run a
1255 different model or update the model, where previous model
1256 weights are not needed. It reduces CPU memory pressure.
1257 """
1258 self.reset_prefix_cache()
1259 self.llm_engine.sleep(level=level)
1260
1261 def wake_up(self, tags: Optional[list[str]] = None):
1262 """

Callers 15

heart_beat_workerFunction · 0.80
send_heart_beatMethod · 0.80
http_botFunction · 0.80
heart_beat_workerFunction · 0.80
send_heart_beatMethod · 0.80
heart_beat_controllerFunction · 0.80
get_answerFunction · 0.80
get_evalFunction · 0.80
get_evalFunction · 0.80
eval_gpt_review.pyFile · 0.80
get_evalFunction · 0.80
http_botFunction · 0.80

Calls 1

reset_prefix_cacheMethod · 0.95

Tested by 2

testFunction · 0.64
testFunction · 0.64