Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Make snli dataset reader work with unlabeled instances #234

Merged
merged 4 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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
Expand Down
4 changes: 2 additions & 2 deletions allennlp_models/pair_classification/dataset_readers/snli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down