-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[V2][RFC][wip] make room for batch eval
This moves the existing eval library to "test_suite_eval" and starts the equivalent for batch runs. Also makes the interface a little clearer. Essentially, the differences are: - each metric runs on a _list_ of inputs, not just one - each input can be paired with a reference. This is possible in the "test suite" setup, but it is clunkier.
- Loading branch information
1 parent
c9fc17a
commit 402d73d
Showing
15 changed files
with
1,055 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from abc import abstractmethod | ||
from typing import Protocol, Sequence, TypeVar | ||
|
||
from aiconfig.eval import batch_common, common | ||
|
||
T_Ref = TypeVar("T_Ref") | ||
T_Ref_contra = TypeVar("T_Ref_contra", contravariant=True) | ||
|
||
|
||
class BatchEvaluationFunctionWithReference( | ||
Protocol[ | ||
common.T_Evaluable, batch_common.T_Ref_contra, common.T_MetricValue_inv | ||
] | ||
): | ||
@abstractmethod | ||
async def __call__( | ||
self, | ||
data: Sequence[common.T_Evaluable], | ||
ref: Sequence[batch_common.T_Ref_contra], | ||
) -> list[common.T_MetricValue_inv]: | ||
pass | ||
|
||
|
||
class BatchEvaluationFunctionWithoutReference( | ||
Protocol[common.T_Evaluable, common.T_MetricValue_inv] | ||
): | ||
@abstractmethod | ||
async def __call__( | ||
self, data: Sequence[common.T_Evaluable] | ||
) -> list[common.T_MetricValue_inv]: | ||
pass |
Oops, something went wrong.