From d182e26b538c77f64c533bc8f0027a4b77b749ad Mon Sep 17 00:00:00 2001 From: Nelson Liu Date: Thu, 25 Mar 2021 17:36:21 -0700 Subject: [PATCH 1/2] Make snli dataset reader work with unlabeled instances --- allennlp_models/pair_classification/dataset_readers/snli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/allennlp_models/pair_classification/dataset_readers/snli.py b/allennlp_models/pair_classification/dataset_readers/snli.py index 5df459530..f8f84dd5b 100644 --- a/allennlp_models/pair_classification/dataset_readers/snli.py +++ b/allennlp_models/pair_classification/dataset_readers/snli.py @@ -80,10 +80,10 @@ def _read(self, file_path: str): with open(file_path, "r") as snli_file: example_iter = (json.loads(line) for line in snli_file) filtered_example_iter = ( - example for example in example_iter if example["gold_label"] != "-" + example for example in example_iter if example.get("gold_label") != "-" ) for example in self.shard_iterable(filtered_example_iter): - label = example["gold_label"] + label = example.get("gold_label") premise = example["sentence1"] hypothesis = example["sentence2"] yield self.text_to_instance(premise, hypothesis, label) From 483796da7cb4828abb5113a673cad3a89ae1f312 Mon Sep 17 00:00:00 2001 From: Nelson Liu Date: Thu, 25 Mar 2021 17:39:48 -0700 Subject: [PATCH 2/2] Add entry to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1fb5df48..981057439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated `QaNet` and `NumericallyAugmentedQaNet` models to remove bias for layers that are followed by normalization layers. - Updated the model cards for `rc-naqanet`, `vqa-vilbert` and `ve-vilbert`. - Predictors now work for the vilbert-multitask model. +- Support unlabeled instances in `SnliDatasetReader`. ## [v2.1.0](https://github.com/allenai/allennlp-models/releases/tag/v2.1.0) - 2021-02-24