mirror of
https://github.com/huggingface/diffusers.git
synced 2026-01-27 17:22:53 +03:00
SchedulerMixin from_pretrained and ConfigMixin Self type annotation (#11192)
This commit is contained in:
@@ -35,6 +35,7 @@ from huggingface_hub.utils import (
|
||||
validate_hf_hub_args,
|
||||
)
|
||||
from requests import HTTPError
|
||||
from typing_extensions import Self
|
||||
|
||||
from . import __version__
|
||||
from .utils import (
|
||||
@@ -185,7 +186,9 @@ class ConfigMixin:
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_config(cls, config: Union[FrozenDict, Dict[str, Any]] = None, return_unused_kwargs=False, **kwargs):
|
||||
def from_config(
|
||||
cls, config: Union[FrozenDict, Dict[str, Any]] = None, return_unused_kwargs=False, **kwargs
|
||||
) -> Union[Self, Tuple[Self, Dict[str, Any]]]:
|
||||
r"""
|
||||
Instantiate a Python class from a config dictionary.
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from typing import Optional, Union
|
||||
|
||||
import torch
|
||||
from huggingface_hub.utils import validate_hf_hub_args
|
||||
from typing_extensions import Self
|
||||
|
||||
from ..utils import BaseOutput, PushToHubMixin
|
||||
|
||||
@@ -99,7 +100,7 @@ class SchedulerMixin(PushToHubMixin):
|
||||
subfolder: Optional[str] = None,
|
||||
return_unused_kwargs=False,
|
||||
**kwargs,
|
||||
):
|
||||
) -> Self:
|
||||
r"""
|
||||
Instantiate a scheduler from a pre-defined JSON configuration file in a local directory or Hub repository.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user