From 5127dae5390f492b98f57e4dd73e690f7ca38540 Mon Sep 17 00:00:00 2001 From: Yernar Sadybekov Date: Tue, 15 Jul 2025 15:43:30 -0700 Subject: [PATCH] Fix boolean support in cmd_conf util Summary: Fixed and extended the boolean argument parsing in the cmd_conf decorator utility. Differential Revision: D78303765 --- torchrec/distributed/benchmark/benchmark_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/torchrec/distributed/benchmark/benchmark_utils.py b/torchrec/distributed/benchmark/benchmark_utils.py index 950e3bd6f..b954dd0c1 100644 --- a/torchrec/distributed/benchmark/benchmark_utils.py +++ b/torchrec/distributed/benchmark/benchmark_utils.py @@ -524,6 +524,9 @@ def wrapper() -> Any: if origin in (list, List): elem_type = get_args(ftype)[0] arg_kwargs.update(nargs="*", type=elem_type) + elif ftype is bool: + # Special handling for boolean arguments + arg_kwargs.update(type=lambda x: x.lower() in ["true", "1", "yes"]) else: arg_kwargs.update(type=ftype)