Skip to content

Commit 5fab6d1

Browse files
committed
cleanup
1 parent 4f84222 commit 5fab6d1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/diffusers/loaders/single_file.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def load_single_file_sub_model(
106106
subfolder=name,
107107
torch_dtype=torch_dtype,
108108
local_files_only=local_files_only,
109-
no_mmap=True,
109+
no_mmap=no_mmap,
110110
**kwargs,
111111
)
112112

@@ -310,7 +310,8 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
310310
- A path to a *directory* (for example `./my_pipeline_directory/`) containing the pipeline
311311
component configs in Diffusers format.
312312
no_mmap ('bool', *optional*, defaults to 'False'):
313-
Whether to use mmap when loading the model.
313+
Whether to disable mmap when loading the model. This option can perform better when the model is on
314+
a network mount or hard drive, which may not handle the seeky-ness of mmap very well.
314315
kwargs (remaining dictionary of keyword arguments, *optional*):
315316
Can be used to overwrite load and saveable variables (the pipeline components of the specific pipeline
316317
class). The overwritten components are passed directly to the pipelines `__init__` method. See example
@@ -509,6 +510,7 @@ def load_module(name, value):
509510
original_config=original_config,
510511
local_files_only=local_files_only,
511512
is_legacy_loading=is_legacy_loading,
513+
no_mmap=no_mmap,
512514
**kwargs,
513515
)
514516
except SingleFileComponentError as e:

src/diffusers/loaders/single_file_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
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.
173173
no_mmap ('bool', *optional*, defaults to 'False'):
174-
Whether to use mmap when loading the model.
174+
Whether to disable mmap when loading the model. This option can perform better when the model is on
175+
a network mount or hard drive, which may not handle the seeky-ness of mmap very well.
175176
kwargs (remaining dictionary of keyword arguments, *optional*):
176177
Can be used to overwrite load and saveable variables (for example the pipeline components of the
177178
specific pipeline class). The overwritten components are directly passed to the pipelines `__init__`
@@ -233,6 +234,7 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
233234
)
234235

235236
mapping_functions = SINGLE_FILE_LOADABLE_CLASSES[mapping_class_name]
237+
236238
checkpoint_mapping_fn = mapping_functions["checkpoint_mapping_fn"]
237239
if original_config is not None:
238240
if "config_mapping_fn" in mapping_functions:

0 commit comments

Comments
 (0)