Skip to content

Commit

Permalink
use "plain" display when running eval_async() outside of eval() (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire authored Jan 26, 2025
1 parent db08438 commit 788787b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Hugging Face: Add support for stop sequences for HF models.
- Docker: More robust parsing of version strings (handle development versions).
- Bugfix: Fix issue w/ approvals for samples with id==0.
- Bugfix: Use "plain" display when running eval_async() outside of eval().

## v0.3.59 (24 January 2025)

Expand Down
11 changes: 10 additions & 1 deletion src/inspect_ai/_eval/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
from inspect_ai.solver._chain import chain
from inspect_ai.solver._solver import Solver, SolverSpec
from inspect_ai.util import SandboxEnvironmentType
from inspect_ai.util._display import DisplayType, display_type, init_display_type
from inspect_ai.util._display import (
DisplayType,
display_type,
display_type_initialized,
init_display_type,
)

from .context import init_eval_context
from .loader import ResolvedTask, resolve_tasks
Expand Down Expand Up @@ -306,6 +311,10 @@ async def eval_async(

_eval_async_running = True

# if we are called outside of eval() then set display type to "plain"
if not display_type_initialized():
init_display_type("plain")

# resolve model and task args
model_args = resolve_args(model_args)
task_args = resolve_args(task_args)
Expand Down
5 changes: 5 additions & 0 deletions src/inspect_ai/util/_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ def display_type() -> DisplayType:
return _display_type
else:
return init_display_type()


def display_type_initialized() -> bool:
global _display_type
return _display_type is not None

0 comments on commit 788787b

Please sign in to comment.