How to test transliteration output - Encoder decoder models

In the below notebook :
https://colab.research.google.com/drive/1U_UmzCX7YdHgZj2F8gjwgl84ahN267oR

While running :
out = infer(net, 'INDIA', 30)
I got the below error :
NameError Traceback (most recent call last)
in ()
----> 1 out = infer(net, ‘INDIA’, 30)

 NameError: name 'infer' is not defined 

How can I solve this error ? Please help

Hi @Himangshu_Sekhar_Sar, please check this thread

1 Like

thanks a lot!

While running :
accuracy = calc_accuracy(net) * 100

accuracy_attn = calc_accuracy(net_att) * 100

print('Accuracy w/o attention ', accuracy)

print(‘Acurracy with attention’, accuracy_attn)

I got the below error:
TypeError Traceback (most recent call last)
in ()
----> 1 accuracy = calc_accuracy(net) * 100
2 accuracy_attn = calc_accuracy(net_att) * 100
3 print('Accuracy w/o attention ', accuracy)
4 print(‘Acurracy with attention’, accuracy_attn)

in calc_accuracy(net, device)
6 eng, hindi = test_data[i]
7 gt = gt_rep(hindi, hindi_alpha2index, device)
----> 8 outputs = infer(net, eng, gt.shape[0], device)
9 correct = 0
10 for index, out in enumerate(outputs):

TypeError: infer() takes 3 positional arguments but 4 were given

You need not to pass device as an argument to infer, please check the function definition accordingly.

1 Like

Thanks! now it’s working

Suppose I want to convert a single string ‘Delhi’ to hindi , to see whether the transliteration works correctly or not , how can I do that ? Will I have to use the test function?

Yes, you need to do it by this function.