MCPcopy
hub / github.com/InternLM/InternLM / sync_upload_fileobj

Method sync_upload_fileobj

internlm/utils/storage_manager.py:276–282  ·  view source on GitHub ↗
(handler, fp: str, *args, saved_obj=None, **kwargs)

Source from the content-addressed store, hash-verified

274
275 @staticmethod
276 def sync_upload_fileobj(handler, fp: str, *args, saved_obj=None, **kwargs):
277 assert isinstance(handler, LocalClient)
278 assert saved_obj is not None
279 fp_dirname = os.path.dirname(fp)
280 if not os.path.exists(fp_dirname):
281 os.makedirs(fp_dirname, exist_ok=True)
282 torch.save(saved_obj, fp, *args, **kwargs)
283
284 @staticmethod
285 def load(handler, fp: str, *args, **kwargs): # pylint: disable=W0613

Callers

nothing calls this directly

Calls 2

existsMethod · 0.80
saveMethod · 0.80

Tested by

no test coverage detected