Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion textattack/shared/attacked_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def words_diff_ratio(self, x: AttackedText) -> float:
Note that current text and `x` must have same number of words.
"""
assert self.num_words == x.num_words
return float(np.sum(self.words != x.words)) / self.num_words
return float(np.sum(np.array(self.words) != np.array(x.words))) / self.num_words

def align_with_model_tokens(
self, model_wrapper: textattack.models.wrappers.ModelWrapper
Expand Down