gpt4 book ai didi

python - 我正在创建一个 AI 聊天机器人,它反复显示错误 : Expected Bytes, 描述符找到

转载 作者:太空宇宙 更新时间:2023-11-03 19:50:12 25 4
gpt4 key购买 nike

以下代码是使用深度学习构建聊天机器人的前几个步骤,我安装了tensorflow、cUDDN、CUDA,但它仍然显示相同的错误。我已经按照 youtube 上的视频教程下载了两次以上所需的所有软件包,只是为了确定,但它仍然没有摆脱这个特定的错误......

import nltk
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()

import numpy
import tflearn
import tensorflow
import random
import json

with open("intents.json") as file:
data = json.load(file)

print(data)

它显示的错误是

expected bytes, Descriptor found
Stack trace:
> File "C:\Users\Himashi\source\repos\ChatBot\ChatBot\chatbot.py", line 6, in <module>
> import tflearn
Loaded 'tensorflow.core.framework.resource_handle_pb2'
Loaded 'tensorflow.core.framework.tensor_pb2'
Loaded 'tensorflow.core.framework.attr_value_pb2'
Loaded 'tensorflow.core.framework.node_def_pb2'
Loaded 'tensorflow.core.framework.graph_pb2'
Loaded 'tensorflow.python'
Loaded 'tensorflow'
Loaded 'tflearn.config'
Loaded 'tflearn'
Loaded '__main__'
Loaded 'runpy'
Traceback (most recent call last):
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\ptvsd_launcher.py", line 119, in <module>
vspd.debug(filename, port_num, debug_id, debug_options, run_as)
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\Packages\ptvsd\debugger.py", line 39, in debug
run()
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\Packages\ptvsd\__main__.py", line 316, in run_file
runpy.run_path(target, run_name='__main__')
File "C:\Users\Himashi\Anaconda3\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Users\Himashi\Anaconda3\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\Himashi\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Himashi\source\repos\ChatBot\ChatBot\chatbot.py", line 6, in <module>
import tflearn
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tflearn\__init__.py", line 4, in <module>
from . import config
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tflearn\config.py", line 3, in <module>
import tensorflow as tf
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tensorflow\core\framework\node_def_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tensorflow\core\framework\tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
File "C:\Users\Himashi\Anaconda3\lib\site-packages\tensorflow\core\framework\resource_handle_pb2.py", line 92, in <module>
__module__ = 'tensorflow.core.framework.resource_handle_pb2'
TypeError: expected bytes, Descriptor found

最佳答案

此错误似乎是 TensorFlow 安装问题。

此外,您的代码仅读取 JSON 文件。如果这只是您想要的,您可以删除 tflearntensorflow 包的导入。

如果您想稍后使用这些软件包,那么我建议检查您的 TensorFlow 安装(按照此 link 获取解决方案)或更新 TensorFlow。

关于python - 我正在创建一个 AI 聊天机器人,它反复显示错误 : Expected Bytes, 描述符找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59889754/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com