Skip to content

Commit

Permalink
Merge pull request #746 from wenh06/fix_filter_by_labels_
Browse files Browse the repository at this point in the history
  • Loading branch information
jxmorris12 authored Jul 24, 2023
2 parents 7d7e500 + dabb8a9 commit 00adb8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion textattack/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def filter_by_labels_(self, labels_to_keep):
"""
if not isinstance(labels_to_keep, set):
labels_to_keep = set(labels_to_keep)
self._dataset = filter(lambda x: x[1] in labels_to_keep, self._dataset)
self._dataset = list(filter(lambda x: x[1] in labels_to_keep, self._dataset))

def __getitem__(self, i):
"""Return i-th sample."""
Expand Down

0 comments on commit 00adb8a

Please sign in to comment.