This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* checklist tests * Update CHANGELOG.md
- Loading branch information
Showing
5 changed files
with
65 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
Empty file.
32 changes: 32 additions & 0 deletions
32
tests/pair_classification/task_checklists/textual_entailment_suite_test.py
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,32 @@ | ||
import pytest | ||
from allennlp.sanity_checks.task_checklists.textual_entailment_suite import TextualEntailmentSuite | ||
from allennlp.common.testing import AllenNlpTestCase | ||
from allennlp.models.archival import load_archive | ||
from allennlp.predictors import Predictor | ||
|
||
from allennlp_models.pair_classification.predictors import * # noqa: F403 | ||
from tests import FIXTURES_ROOT | ||
|
||
|
||
class TestTextualEntailmentSuite(AllenNlpTestCase): | ||
@pytest.mark.parametrize( | ||
"model", | ||
[ | ||
"decomposable_attention", | ||
"esim", | ||
], | ||
) | ||
def test_run(self, model: str): | ||
|
||
archive = load_archive( | ||
FIXTURES_ROOT / "pair_classification" / model / "serialization" / "model.tar.gz" | ||
) | ||
predictor = Predictor.from_archive(archive) | ||
|
||
data = [ | ||
("Alice and Bob are friends.", "Alice is Bob's friend."), | ||
("The park had children playing", "The park was empty."), | ||
] | ||
|
||
suite = TextualEntailmentSuite(probs_key="label_probs", add_default_tests=True, data=data) | ||
suite.run(predictor, max_examples=10) |
Empty file.
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,27 @@ | ||
import pytest | ||
from allennlp.sanity_checks.task_checklists.question_answering_suite import QuestionAnsweringSuite | ||
from allennlp.common.testing import AllenNlpTestCase | ||
from allennlp.models.archival import load_archive | ||
from allennlp.predictors import Predictor | ||
|
||
from allennlp_models.rc.predictors import * # noqa: F403 | ||
from tests import FIXTURES_ROOT | ||
|
||
|
||
class TestQuestionAnsweringSuite(AllenNlpTestCase): | ||
@pytest.mark.parametrize( | ||
"model", | ||
[ | ||
"bidaf", | ||
], | ||
) | ||
def test_run(self, model: str): | ||
archive = load_archive(FIXTURES_ROOT / "rc" / model / "serialization" / "model.tar.gz") | ||
predictor = Predictor.from_archive(archive) | ||
|
||
data = [ | ||
("Alice is taller than Bob.", "Who is taller?"), | ||
("Children were playing in the park.", "Was the park empty?"), | ||
] | ||
suite = QuestionAnsweringSuite(context_key="passage", add_default_tests=True, data=data) | ||
suite.run(predictor, max_examples=10) |