Skip to content

Commit c899fd0

Browse files
committed
revert changes
1 parent c34ce42 commit c899fd0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/diffusers/models/model_loading_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def load_state_dict(
136136
checkpoint_file: Union[str, os.PathLike],
137137
variant: Optional[str] = None,
138138
dduf_entries: Optional[Dict[str, DDUFEntry]] = None,
139+
disable_mmap: bool = False,
139140
):
140141
"""
141142
Reads a checkpoint file, returning properly formatted errors if they arise.
@@ -151,6 +152,8 @@ def load_state_dict(
151152
# tensors are loaded on cpu
152153
with dduf_entries[checkpoint_file].as_mmap() as mm:
153154
return safetensors.torch.load(mm)
155+
if disable_mmap:
156+
return safetensors.torch.load(open(checkpoint_file, "rb").read())
154157
else:
155158
return safetensors.torch.load_file(checkpoint_file, device="cpu")
156159
elif file_extension == GGUF_FILE_EXTENSION:

0 commit comments

Comments
 (0)