-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from tiran/entry_point
Add entry points for evaluator classes
- Loading branch information
Showing
5 changed files
with
45 additions
and
0 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 |
---|---|---|
|
@@ -6,5 +6,7 @@ class Evaluator: | |
Parent class for Evaluators | ||
""" | ||
|
||
name: str | ||
|
||
def __init__(self) -> None: | ||
pass |
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
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,29 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Standard | ||
from importlib.metadata import entry_points | ||
|
||
# First Party | ||
from instructlab.eval.evaluator import Evaluator | ||
from instructlab.eval.mmlu import MMLUBranchEvaluator, MMLUEvaluator | ||
from instructlab.eval.mt_bench import MTBenchBranchEvaluator, MTBenchEvaluator | ||
|
||
|
||
def test_evaluator_eps(): | ||
expected = { | ||
"mmlu": MMLUEvaluator, | ||
"mmlu_branch": MMLUBranchEvaluator, | ||
"mt_bench": MTBenchEvaluator, | ||
"mt_bench_branch": MTBenchBranchEvaluator, | ||
} | ||
eps = entry_points(group="instructlab.eval.evaluator") | ||
found = {} | ||
for ep in eps: | ||
# different project | ||
if not ep.module.startswith("instructlab.eval"): | ||
continue | ||
evaluator = ep.load() | ||
assert issubclass(evaluator, Evaluator) | ||
assert evaluator.name == ep.name | ||
found[ep.name] = evaluator | ||
|
||
assert found == expected |