Skip to content

Commit 781a914

Browse files
committed
allow from_single_file to be called from automodel.
1 parent c222570 commit 781a914

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/diffusers/models/auto_model.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
from typing import Optional, Union
1717

1818
from huggingface_hub.utils import validate_hf_hub_args
19+
from typing_extensions import Self
1920

2021
from ..configuration_utils import ConfigMixin
22+
from ..loaders import FromOriginalModelMixin
2123
from ..utils import logging
2224

2325

@@ -204,3 +206,8 @@ def from_pretrained(cls, pretrained_model_or_path: Optional[Union[str, os.PathLi
204206

205207
kwargs = {**load_config_kwargs, **kwargs}
206208
return model_cls.from_pretrained(pretrained_model_or_path, **kwargs)
209+
210+
@classmethod
211+
@validate_hf_hub_args
212+
def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] = None, **kwargs) -> Self:
213+
return FromOriginalModelMixin.from_single_file(pretrained_model_link_or_path_or_dict, **kwargs)

0 commit comments

Comments
 (0)