瀏覽代碼

gguf-py : allow converting multi-tensor models from read-only locations (#18100)

Yuri Khrustalev 1 月之前
父節點
當前提交
2973a65ecb
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      gguf-py/gguf/utility.py

+ 1 - 1
gguf-py/gguf/utility.py

@@ -288,7 +288,7 @@ class LocalTensor:
     data_range: LocalTensorRange
 
     def mmap_bytes(self) -> np.ndarray:
-        return np.memmap(self.data_range.filename, offset=self.data_range.offset, shape=self.data_range.size)
+        return np.memmap(self.data_range.filename, mode='r', offset=self.data_range.offset, shape=self.data_range.size)
 
 
 class SafetensorsLocal: