tf_chatbot_seq2seq_antilm icon indicating copy to clipboard operation
tf_chatbot_seq2seq_antilm copied to clipboard

Error on test mode: seq2seq_model_utils.py

Open jimmytuc opened this issue 7 years ago • 3 comments

I've found this error occured when trying to test with data set is a part of the training data which has been done.

File /chatbot_seq2seq_antilm/lib/seq2seq_model_utils.py", line 49, in dict_lookup word = rev_vocab[out] if (out < len(rev_vocab)) else data_utils._UNK TypeError: only integer scalar arrays can be converted to a scalar index

Do you have any suggestions ? Thanks for your great works, Regards, JP.Page

jimmytuc avatar May 08 '17 03:05 jimmytuc

This is my command to run: python main.py --mode test --model_name my_modelname --vocab_size 600000 --size 128 --beam_size 5 --antilm 0.7

jimmytuc avatar May 08 '17 03:05 jimmytuc

I've found the problem when i enable the antilm that error will occurs Do anyone have any suggestions?

jimmytuc avatar May 09 '17 09:05 jimmytuc

I found this problem, too.

And I solve it by add out = out[0] before word = rev_vocab[out] if (out < len(rev_vocab)) else data_utils._UNK in seq2seq_model_utils.py

therefore, the function dict_lookup():

def dict_lookup(rev_vocab, out):
    out = out[0]    ## deal bug
    word = rev_vocab[out] if (out < len(rev_vocab)) else data_utils._UNK
    if isinstance(word, bytes):
        word = word.decode()
    return word

But I haven't tried if I don't use --antilm setting, this modify would be correct or not.

thisray avatar Jul 05 '17 13:07 thisray