MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / _write_entry

Method _write_entry

examples/server/server.py:12452–12466  ·  view source on GitHub ↗
(
        self,
        path: Path,
        tensors: Dict[str, np.ndarray],
    )

Source from the content-addressed store, hash-verified

12450 )
12451
12452 def _write_entry(
12453 self,
12454 path: Path,
12455 tensors: Dict[str, np.ndarray],
12456 ) -> None:
12457 tmp_path = path.with_name(f"{path.name}.tmp")
12458 try:
12459 self._save_file(tensors, tmp_path, self._metadata)
12460 os.replace(tmp_path, path)
12461 except Exception:
12462 try:
12463 tmp_path.unlink()
12464 except FileNotFoundError:
12465 pass
12466 raise
12467
12468 def _load_entries(self) -> None:
12469 for path in sorted(self.path.glob("*.safetensors")):

Callers 1

saveMethod · 0.95

Calls 1

_save_fileMethod · 0.95

Tested by

no test coverage detected