Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
7fb481f8
Unverified
Commit
7fb481f8
authored
Feb 10, 2025
by
hlky
Committed by
GitHub
Feb 10, 2025
Browse files
Add `Self` type hint to `ModelMixin`'s `from_pretrained` (#10742)
parent
9f5ad1db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/diffusers/models/modeling_utils.py
src/diffusers/models/modeling_utils.py
+2
-1
No files found.
src/diffusers/models/modeling_utils.py
View file @
7fb481f8
...
...
@@ -31,6 +31,7 @@ import torch.utils.checkpoint
from
huggingface_hub
import
DDUFEntry
,
create_repo
,
split_torch_state_dict_into_shards
from
huggingface_hub.utils
import
validate_hf_hub_args
from
torch
import
Tensor
,
nn
from
typing_extensions
import
Self
from
..
import
__version__
from
..hooks
import
apply_layerwise_casting
...
...
@@ -605,7 +606,7 @@ class ModelMixin(torch.nn.Module, PushToHubMixin):
@
classmethod
@
validate_hf_hub_args
def
from_pretrained
(
cls
,
pretrained_model_name_or_path
:
Optional
[
Union
[
str
,
os
.
PathLike
]],
**
kwargs
):
def
from_pretrained
(
cls
,
pretrained_model_name_or_path
:
Optional
[
Union
[
str
,
os
.
PathLike
]],
**
kwargs
)
->
Self
:
r
"""
Instantiate a pretrained PyTorch model from a pretrained model configuration.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment