webis-de / small-text

Active Learning for Text Classification in Python
https://small-text.readthedocs.io/
MIT License
547 stars 60 forks source link

Cloning a nested DatasetsViews raises an AttributeError #47

Open chschroeder opened 1 year ago

chschroeder commented 1 year ago

Bug description

Calling clone() on a nested dataset view raises the following error:

[...]
  File "/path/to/site-packages/small_text/active_learner.py", line 389, in _retrain
    dataset = self.dataset[self.indices_labeled].clone()
  File "/path/tob-v2-ifn6Asey/lib/python3.8/site-packages/small_text/integrations/transformers/datasets.py", line 32, in clone
    target_labels = None if self.dataset.track_target_labels else np.copy(self.target_labels)
AttributeError: 'TransformersDatasetView' object has no attribute 'track_target_labels'

The fix is easy, but this is also a sign that the "target label tracking" is not properly mapped to the dataset views.

Maybe the target tracking functionality was also never needed in the first place.

Steps to reproduce

Create a DatasetView of a DataSetView of a DataSet, then call .clone() (the outermost) view.

Expected behavior

--

Environment:

small-text integrations (e.g., transformers): pytorch, transformers

Addition information