Skip to content

Commit

Permalink
set default num_workers=-1
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczmarj committed Mar 7, 2024
1 parent e59d979 commit 0691936
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wsinfer_mil/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit 0691936

Please sign in to comment.