Skip to content

Commit 94fc482

Browse files
SSYernarfacebook-github-bot
authored andcommitted
Fix boolean support in cmd_conf util (#3198)
Summary: Pull Request resolved: #3198 Fixed and extended the boolean argument parsing in the cmd_conf decorator utility. Reviewed By: iamzainhuda Differential Revision: D78303765 fbshipit-source-id: 441226586d2a104cc6d0fb5de15f09587ec21bd8
1 parent 503d05b commit 94fc482

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

torchrec/distributed/benchmark/benchmark_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,9 @@ def wrapper() -> Any:
524524
if origin in (list, List):
525525
elem_type = get_args(ftype)[0]
526526
arg_kwargs.update(nargs="*", type=elem_type)
527+
elif ftype is bool:
528+
# Special handling for boolean arguments
529+
arg_kwargs.update(type=lambda x: x.lower() in ["true", "1", "yes"])
527530
else:
528531
arg_kwargs.update(type=ftype)
529532

0 commit comments

Comments
 (0)