Skip to content

Commit c895d86

Browse files
committed
propagate no_mmap
1 parent bcca53b commit c895d86

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/diffusers/loaders/single_file_model.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
170170
revision (`str`, *optional*, defaults to `"main"`):
171171
The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
172172
allowed by Git.
173+
no_mmap ('bool', *optional*, defaults to 'False'):
174+
Whether to use mmap when loading the model.
173175
kwargs (remaining dictionary of keyword arguments, *optional*):
174176
Can be used to overwrite load and saveable variables (for example the pipeline components of the
175177
specific pipeline class). The overwritten components are directly passed to the pipelines `__init__`
@@ -214,6 +216,8 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
214216
subfolder = kwargs.pop("subfolder", None)
215217
revision = kwargs.pop("revision", None)
216218
torch_dtype = kwargs.pop("torch_dtype", None)
219+
no_mmap = kwargs.pop("no_mmap", False)
220+
logger.warning("no_mmap2: " + str(no_mmap))
217221

218222
if isinstance(pretrained_model_link_or_path_or_dict, dict):
219223
checkpoint = pretrained_model_link_or_path_or_dict
@@ -226,6 +230,7 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
226230
cache_dir=cache_dir,
227231
local_files_only=local_files_only,
228232
revision=revision,
233+
no_mmap=no_mmap,
229234
)
230235

231236
mapping_functions = SINGLE_FILE_LOADABLE_CLASSES[mapping_class_name]

0 commit comments

Comments
 (0)