Skip to content

Commit

Permalink
feat: Add max_workers argument to run_dataset.
Browse files Browse the repository at this point in the history
Task: IL-327
  • Loading branch information
SebastianNiehusAA committed Apr 23, 2024
1 parent e4307c2 commit a236f9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

### Breaking Changes
- feature: `run_dataset` now takes `max_workers` as an additional argument. Defaults to 10, as it was hardcoded before.

### New Features

Expand Down
4 changes: 3 additions & 1 deletion src/intelligence_layer/evaluation/run/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def run_dataset(
tracer: Optional[Tracer] = None,
num_examples: Optional[int] = None,
abort_on_error: bool = False,
max_workers: int = 10,
) -> RunOverview:
"""Generates all outputs for the provided dataset.
Expand All @@ -88,6 +89,7 @@ def run_dataset(
num_examples: An optional int to specify how many examples from the dataset should be run.
Always the first n examples will be taken.
abort_on_error: Flag to abort all run when an error occurs. Defaults to False.
max_workers: Maximum number of workers in the thread pool.
Returns:
An overview of the run. Outputs will not be returned but instead stored in the
Expand Down Expand Up @@ -123,7 +125,7 @@ def run(
examples = islice(examples, num_examples)
run_id = str(uuid4())
start = utc_now()
with ThreadPoolExecutor(max_workers=10) as executor:
with ThreadPoolExecutor(max_workers=max_workers) as executor:
ids_and_outputs = tqdm(executor.map(run, examples), desc="Evaluating")

failed_count = 0
Expand Down

0 comments on commit a236f9b

Please sign in to comment.