diff options
author | Galunid <karolek1231456@gmail.com> | 2023-11-25 22:45:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-25 22:45:02 +0100 |
commit | 1ddb52ec38f9931925a587f45a23b1c37152c028 (patch) | |
tree | 8e4736739e4c87e9c4437f137e39f4f8186340ed | |
parent | f837c3a992b2b6146936cb120871a8cf9d0e3857 (diff) |
scripts : Use mmap in torch load (#4202)
* Use mmap in torch load, prefer .bin files when loading
* Revert .bin > .safetensors preference
-rwxr-xr-x | convert-hf-to-gguf.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index 147d5717..53ce76c7 100755 --- a/convert-hf-to-gguf.py +++ b/convert-hf-to-gguf.py @@ -59,7 +59,7 @@ class Model: from safetensors import safe_open ctx = cast(ContextManager[Any], safe_open(self.dir_model / part_name, framework="pt", device="cpu")) else: - ctx = contextlib.nullcontext(torch.load(self.dir_model / part_name, map_location="cpu")) + ctx = contextlib.nullcontext(torch.load(str(self.dir_model / part_name), map_location="cpu", mmap=True, weights_only=True)) with ctx as model_part: for name in model_part.keys(): |