MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / enable_checkpointing

Function enable_checkpointing

PATH/core/models/ckpt.py:228–235  ·  view source on GitHub ↗

Makes :func:`is_checkpointing` return :data:`True` within a context.

()

Source from the content-addressed store, hash-verified

226
227@contextmanager
228def enable_checkpointing() -> Generator[None, None, None]:
229 """Makes :func:`is_checkpointing` return :data:`True` within a context."""
230 orig = thread_local.is_checkpointing
231 thread_local.is_checkpointing = True
232 try:
233 yield
234 finally:
235 thread_local.is_checkpointing = orig
236
237
238@contextmanager

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected