daniel-kukiela / nmt-chatbot

NMT Chatbot
GNU General Public License v3.0
387 stars 214 forks source link

inference.py only translating one time although "num_translations_per_input": 20 #161

Open M0rica opened 4 years ago

M0rica commented 4 years ago

This is not really a bug, i was just wondering why inference.py is only translating my input one time even though "num_translations_per_input" in hparams is 20. Because of that, the model allways respons with the same answer to the same input. The model is trained on ~12 million reddit pairs. Why is this and is there a solution to this? Thanks

Nathan-Chell commented 3 years ago

I'm gonna copy and paste what I wrote on a more recent post asking the same thing:

Inference.py returns the highest scoring response. If you look in inference.py you will see a line at the bottom that mentions max (Not at my pc rn cannot confirm line number), that is returning the highest score. If you want to print all responses you'll have to change this section of code.

Hope this helps.

aditya543 commented 2 years ago

Hey everyone! I finally solved this issue after doing a lot of R&D on the nmt package. The reason why your chatbot produces only one response is due to the hyper-parameter: 'infer-mode' set to 'greedy'. Go to setup/settings.py and in the hparams dict add a new key: 'infer-mode' and set it to 'beam-search'. This will solve your issue, thanks! Check out the image below.

Screen Shot 2022-06-19 at 3 09 08 PM