Skip to content

Commit a3faf3f

Browse files
authored
[Core] fix: legacy model mapping (huggingface#8416)
* fix: legacy model mapping * remove print
1 parent 867a2b0 commit a3faf3f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/diffusers/models/modeling_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,9 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
10571057
# To prevent depedency import problem.
10581058
from .model_loading_utils import _fetch_remapped_cls_from_config
10591059

1060+
# Create a copy of the kwargs so that we don't mess with the keyword arguments in the downstream calls.
1061+
kwargs_copy = kwargs.copy()
1062+
10601063
cache_dir = kwargs.pop("cache_dir", None)
10611064
force_download = kwargs.pop("force_download", False)
10621065
resume_download = kwargs.pop("resume_download", None)
@@ -1094,4 +1097,4 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
10941097
# resolve remapping
10951098
remapped_class = _fetch_remapped_cls_from_config(config, cls)
10961099

1097-
return remapped_class.from_pretrained(pretrained_model_name_or_path, **kwargs)
1100+
return remapped_class.from_pretrained(pretrained_model_name_or_path, **kwargs_copy)

0 commit comments

Comments
 (0)