marcotcr / checklist

Beyond Accuracy: Behavioral Testing of NLP models with CheckList
MIT License
2.01k stars 204 forks source link

local variable 'orig_ret' referenced before assignment #13

Closed Riroaki closed 4 years ago

Riroaki commented 4 years ago

When I tried to use perturb functions and replace words with synonyms, this error occurred. And I checked the code and found the variable orig_ret would not be defined if no candidates are suggested. https://github.com/marcotcr/checklist/blob/64a810a3586f276521dda73d4223c1e1e5ae7151/checklist/text_generation.py#L278

To solve this, I suggest define the variable before assigning the value of new_ret to it.

marcotcr commented 4 years ago

Thanks! Fixed in 832b5ba