Skip to content

Commit

Permalink
Fix/add some type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
bradhilton committed Nov 11, 2024
1 parent ac4f88e commit 6de3536
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions torchtune/config/_instantiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def _create_component(
_component_: Callable[..., Any],
args: Tuple[Any, ...],
kwargs: Dict[str, Any],
):
) -> Any:
return _component_(*args, **kwargs)


def _instantiate_node(node: Dict[str, Any], *args: Tuple[Any, ...]):
def _instantiate_node(node: Dict[str, Any], *args: Any) -> Any:
"""
Creates the object specified in _component_ field with provided positional args
and kwargs already merged. Raises an InstantiationError if _component_ is not specified.
Expand All @@ -40,8 +40,8 @@ def _instantiate_node(node: Dict[str, Any], *args: Tuple[Any, ...]):

def instantiate(
config: DictConfig,
*args: Tuple[Any, ...],
**kwargs: Dict[str, Any],
*args: Any,
**kwargs: Any,
) -> Any:
"""
Given a DictConfig with a _component_ field specifying the object to instantiate and
Expand Down
2 changes: 1 addition & 1 deletion torchtune/config/_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def parse_known_args(self, *args, **kwargs) -> Tuple[Namespace, List[str]]:
return namespace, unknown_args


def parse(recipe_main: Recipe) -> Callable[[Recipe], Any]:
def parse(recipe_main: Recipe) -> Callable[[], Any]:
"""
Decorator that handles parsing the config file and CLI overrides
for a recipe. Use it on the recipe's main function.
Expand Down

0 comments on commit 6de3536

Please sign in to comment.