MCPcopy Create free account
hub / github.com/Pints-AI/1.5-Pints / lazy_load

Class lazy_load

lit_gpt/utils_old.py:218–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216
217
218class lazy_load:
219 def __init__(self, fn):
220 self.zf = torch._C.PyTorchFileReader(str(fn))
221 with BytesIO(self.zf.get_record("data.pkl")) as pkl:
222 mup = LazyLoadingUnpickler(pkl, self)
223 self.sd = mup.load()
224
225 def __enter__(self):
226 return self.sd
227
228 def __exit__(self, exc_type, exc_val, exc_tb):
229 del self.zf # I don't think there is a way to force closing...
230 self.zf = None
231
232
233def check_valid_checkpoint_dir(checkpoint_dir: Path) -> None:

Callers 3

convert_lit_checkpointFunction · 0.90
convert_hf_checkpointFunction · 0.90
load_checkpointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected