'The truth value of an array with more than one element is ambiguous. Use a.any() or a.all(). For converting predictions into text
I am working on a language translation model and while executing a particular code cell, I get a value error. The code is mentioned below.
preds_text = []
for i in preds:
temp = []
for j in range(len(i)):
t = get_word((i[j]), eng_tokenizer)
if j>0:
if (t == get_word(i[j-1], eng_tokenizer)) or (t == None):
temp.append('')
else:
temp.append(t)
else:
if(t == None):
temp.append('')
else:
temp.append(t)
preds_text.append(''.join(temp))
This particular line causes the error
t = get_word((i[j]), eng_tokenizer)
This is the error I got after running it
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Can anyone please help me out in this regard?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
