Skip to content

Commit

Permalink
Add from_dict overload for when return_unused_kwargs is a bool
Browse files Browse the repository at this point in the history
type checkers won't infer Union[Literal[True], Literal[False]] in this case, so we need to manually define it microsoft/pyright#5230
  • Loading branch information
ringohoffman committed Jun 4, 2023
1 parent ed3dc23 commit ecfe33d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/transformers/utils/quantization_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ def from_dict(
) -> Tuple[Self, Dict[str, Any]]: # type: ignore[valid-type]
...

@overload
@classmethod
def from_dict(
cls, config_dict: Dict[str, Any], return_unused_kwargs: bool, **kwargs: Any
) -> Union[Self, Tuple[Self, Dict[str, Any]]]: # type: ignore[valid-type]
...

@classmethod
def from_dict(
cls, config_dict: Dict[str, Any], return_unused_kwargs: bool, **kwargs: Any
Expand Down

0 comments on commit ecfe33d

Please sign in to comment.