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

Method save

lit_gpt/utils_old.py:380–389  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

378 raise TypeError(f"can only store tensors early, not {type(tensor)}")
379
380 def save(self, obj):
381 if self.has_saved:
382 raise RuntimeError("have already saved")
383 # Write the pickle data for `obj`
384 data_buf = BytesIO()
385 pickler = IncrementalPyTorchPickler(self, data_buf, protocol=5)
386 pickler.dump(obj)
387 data_value = data_buf.getvalue()
388 self.zipfile.write_record("data.pkl", data_value, len(data_value))
389 self.has_saved = True
390
391 def _write_storage_and_return_key(self, storage):
392 if self.has_saved:

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected