我在这个github之后建立了chatbot: https://github.com/suriyadeepan/easy_seq2seq/tree/master/data
我也获得了数据:https://help.github.com/articles/creating-a-pull-request-template-for-your-repository/
我在python 3.5中使用tensorflow 0.12。有人可以帮我解决这个问题:>>模式:测试
Traceback (most recent call last): File "execute.py", line 324, in decode() File "execute.py", line 220, in decode enc_vocab, _ = data_utils.initialize_vocabulary(enc_vocab_path) File "D:\My_document\AI\Chatbot_Conversation\tensorflow_chatbot-master\data_utils.py", line 86, in initialize_vocabulary rev_vocab.extend(f.readlines()) File "C:\Users\Hoang\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 131, in readlines s = self.readline() File "C:\Users\Hoang\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 124, in readline return compat.as_str_any(self._read_buf.ReadLineAsString()) File "C:\Users\Hoang\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\util\compat.py", line 106, in as_str_any return as_str(value) File "C:\Users\Hoang\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\util\compat.py", line 84, in as_text return bytes_or_text.decode(encoding) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 1: invalid start byte
此错误意味着我需要将数据修改为utf-8? 我感谢任何帮助。谢谢!
答案 0 :(得分:0)
请尝试使用encoding ='unicode_escape'读取数据。例如
df = pd.read_csv('file_name.csv',encoding ='unicode_escape')
对我有用。