Skip to content

Commit

Permalink
Add timeout to eval.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 677851485
  • Loading branch information
yifenglou authored and langfun authors committed Sep 23, 2024
1 parent ac0dd64 commit 9ee327e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions langfun/core/eval/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def run(
summary: bool = True,
pivot_field: str = 'lm',
from_root: bool = True,
timeout: int | None = None,
**kwargs,
) -> Union['Summary', pg.Dict]:
"""Run the evaluation, which fills and returns the result."""
Expand Down Expand Up @@ -265,6 +266,7 @@ def run(
verbose=verbose,
progress_bar=progress_bar,
label=label,
timeout=timeout,
**kwargs,
)

Expand Down Expand Up @@ -398,6 +400,7 @@ def _run(
verbose: bool,
progress_bar: int | None,
label: str | None,
timeout: int | None = None,
**kwargs,
) -> None:
"""Run the evaluate and fill `self.result`. Subclass to implement."""
Expand Down Expand Up @@ -1106,6 +1109,7 @@ def _run(
verbose: bool,
progress_bar: int | None,
label: str | None,
timeout: int | None = None,
**kwargs,
) -> None:
# Setup examples.
Expand Down Expand Up @@ -1136,6 +1140,7 @@ def _process(example: Any):
max_workers=self.max_workers,
show_progress=progress_bar or False,
status_fn=self._status,
timeout=timeout,
):
if error is not None:
message = (
Expand Down

0 comments on commit 9ee327e

Please sign in to comment.