QData / TextAttack

TextAttack 🐙 is a Python framework for adversarial attacks, data augmentation, and model training in NLP https://textattack.readthedocs.io/en/master/
https://textattack.readthedocs.io/en/master/
MIT License
2.98k stars 397 forks source link

`BackTranslationAugmenter` produces an incorrect number of transformations #800

Open aemartinez opened 3 months ago

aemartinez commented 3 months ago

Describe the bug Calling the augment function of a BackTranslationAugmenter produces a list with a length that appears to be non-deterministic, sometimes not matching the value of the transformations_per_example initialization parameter.

To Reproduce Run the following code:

import textattack
augmenter = textattack.augmentation.recipes.BackTranslationAugmenter(transformations_per_example=5)
s = "You are in the kitchen."
ls = augmenter.augment(s)
print(len(ls))

Expected behavior Expected output: 5 Actual output: 3

System Information (please complete the following information):