From 0691936c10b3a4d61ce2d5808781c912c2708856 Mon Sep 17 00:00:00 2001 From: kaczmarj Date: Thu, 7 Mar 2024 12:46:16 -0500 Subject: [PATCH] set default num_workers=-1 --- wsinfer_mil/cli.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wsinfer_mil/cli.py b/wsinfer_mil/cli.py index d992820..921855b 100644 --- a/wsinfer_mil/cli.py +++ b/wsinfer_mil/cli.py @@ -82,9 +82,10 @@ def cli() -> None: @click.option( "-j", "--num-workers", - help="Number of workers to use during patch feature extraction", - type=click.IntRange(min=0, max=os.cpu_count()), - default=4, + help="Number of workers to use during patch feature extraction. -1 (default) uses" + " all cores.", + type=click.IntRange(min=-1, max=os.cpu_count()), + default=-1, show_default=True, ) @click.option( @@ -106,6 +107,8 @@ def run( json: bool, ) -> None: model = load_torchscript_model_from_hf(hf_repo_id, hf_repo_revision) + if num_workers == -1: + num_workers = os.cpu_count() or 0 _run_impl( wsi_path=wsi_path, model=model,