Unverified Commit 78c2fdc5 authored by hlky's avatar hlky Committed by GitHub
Browse files

SchedulerMixin from_pretrained and ConfigMixin Self type annotation (#11192)

parent 54dac3a8
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment