Skip to content

Commit 5854ad1

Browse files
committed
Add Self type hint to ModelMixin's from_pretrained
1 parent d43ce14 commit 5854ad1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/diffusers/models/modeling_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from huggingface_hub import DDUFEntry, create_repo, split_torch_state_dict_into_shards
3232
from huggingface_hub.utils import validate_hf_hub_args
3333
from torch import Tensor, nn
34+
from typing_extensions import Self
3435

3536
from .. import __version__
3637
from ..hooks import apply_layerwise_casting
@@ -605,7 +606,7 @@ def dequantize(self):
605606

606607
@classmethod
607608
@validate_hf_hub_args
608-
def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], **kwargs):
609+
def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], **kwargs) -> Self:
609610
r"""
610611
Instantiate a pretrained PyTorch model from a pretrained model configuration.
611612

0 commit comments

Comments
 (0)