ChatBot-PyTorch
ChatBot-PyTorch copied to clipboard
能否幫忙看一下我寫的word_index_dict與index_word_dict
我將SRC放在 David's save_qa_corpus_to_pickle.py
在predict時,會顯示: Traceback (most recent call last): "predict_chatbot.py", line 54, in chat
answer=answer.contiguous().view(-1,len(word_index_dict)+2) RuntimeError: shape '[-1, 6714]' is invalid for input of size 104660
这个应该是词矢量的维度错了。你确定是做了分字还是分词?
如我放置的源代碼: https://github.com/DavidLanz/ChatBot-PyTorch/blob/master/save_qa_corpus_to_pickle.py ,是以分"字"做的,不是分詞,還是您方便可以下載我的.py下去試試看,產生的word_index_dict以及index_word_dict兩個檔案,我嘗試dump之後的結果,和你的pickle幾乎是一樣的,只是我不能確認shape對或是不對。
如我放置的源代碼: https://github.com/DavidLanz/ChatBot-PyTorch/blob/master/save_qa_corpus_to_pickle.py ,是以分"字"做的,不是分詞,還是您方便可以下載我的.py下去試試看,產生的word_index_dict以及index_word_dict兩個檔案,我嘗試dump之後的結果,和你的pickle幾乎是一樣的,只是我不能確認shape對或是不對。
你的报错目测是输入的维度不对。输入的是序列[Batch_size, time_step, word_vector]
如我放置的源代碼: https://github.com/DavidLanz/ChatBot-PyTorch/blob/master/save_qa_corpus_to_pickle.py ,是以分"字"做的,不是分詞,還是您方便可以下載我的.py下去試試看,產生的word_index_dict以及index_word_dict兩個檔案,我嘗試dump之後的結果,和你的pickle幾乎是一樣的,只是我不能確認shape對或是不對。
这个问题有解决嘛,好兄弟
如我放置的源代碼: https://github.com/DavidLanz/ChatBot-PyTorch/blob/master/save_qa_corpus_to_pickle.py ,是以分"字"做的,不是分詞,還是您方便可以下載我的.py下去試試看,產生的word_index_dict以及index_word_dict兩個檔案,我嘗試dump之後的結果,和你的pickle幾乎是一樣的,只是我不能確認shape對或是不對。
这个问题有解决嘛,好兄弟
This is a project I did too long ago. Please dig it by yourself. Sorry.