You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After calling filter_by_labels_, the _dataset attribute of a textattack.datasets.dataset.Dataset instance is no longer a list but a filter, which has no __len__ method, hence calling the __len__ method of textattack.datasets.dataset.Dataset would result in TypeError.
To Reproduce
importtextattackds=textattack.datasets.dataset.Dataset(
dataset=[
("Not good not bad.", 2),
("It is funny.", 1),
("Not interesting at all!", 0),
],
)
len(ds) # 3ds.filter_by_labels_(labels_to_keep=[0, 1])
len(ds) # TypeError
Expected behavior
len method raises no error.
Screenshots or Traceback
System Information (please complete the following information):
OS: Linux
Textattack: master
Additional context
NA
The text was updated successfully, but these errors were encountered:
Describe the bug
After calling
filter_by_labels_
, the_dataset
attribute of atextattack.datasets.dataset.Dataset
instance is no longer alist
but afilter
, which has no__len__
method, hence calling the__len__
method oftextattack.datasets.dataset.Dataset
would result inTypeError
.To Reproduce
Expected behavior
len
method raises no error.Screenshots or Traceback
System Information (please complete the following information):
Additional context
NA
The text was updated successfully, but these errors were encountered: