我决定看看聊天中神经网络的实现,并尝试在我的计算机上运行代码,但不幸的是没有发生任何事情......这是控制台输出:
Traceback (most recent call last):
File "C:\Users\akkenrl\Voice_ChatBot\bot.py", line 19, in <module>
from text_to_text import TextToText
File "C:\Users\akkenrl\Voice_ChatBot\text_to_text.py", line 24, in <module>
from seq2seq.models import AttentionSeq2Seq
File "C:\Users\akkenrl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\seq2seq-1.0.0-py3.11.egg\seq2seq\__init__.py", line 1, in <module>
File "C:\Users\akkenrl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\seq2seq-1.0.0-py3.11.egg\seq2seq\cells.py", line 1, in <module>
File "C:\Users\akkenrl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\recurrentshop-1.0.0-py3.11.egg\recurrentshop\__init__.py", line 1, in <module>
File "C:\Users\akkenrl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\recurrentshop-1.0.0-py3.11.egg\recurrentshop\engine.py", line 4, in <module>
File "C:\Users\akkenrl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\recurrentshop-1.0.0-py3.11.egg\recurrentshop\backend\__init__.py", line 5, in <module>
File "C:\Users\akkenrl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\recurrentshop-1.0.0-py3.11.egg\recurrentshop\backend\tensorflow_backend.py", line 1, in <module>
ImportError: cannot import name 'tensorflow_backend' from 'keras.backend' (C:\Users\akkenrl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\keras\backend\__init__.py)
我从中克隆代码的存储库:| ||https://github.com/Desklop/Voice_ChatBot 原则上,我安装了所需的所有附加组件,但由于某种原因它给出了错误,决定在 Google 上搜索,但他们在那里写了什么根本不起作用或者只会让情况变得更糟......
In principle, I installed all the add-ons that were required, but for some reason it gave an error, decided to search on Google, but what they wrote there does not work at all or only makes it worse...
The error message "ImportError: cannot import name 'tensorflow_backend' from 'keras.backend'" typically arises when you are using an outdated version of Keras. In recent versions of Keras, the TensorFlow backend is integrated directly, and the separate
tensorflow_backend
module no longer exists.
Here's how to resolve the issue:
-
Update Keras and TensorFlow: Ensure you have the latest versions of both libraries installed. You can upgrade them using pip:
bash pip install --upgrade tensorflow keras
-
Check for Conflicting Installations: Multiple Keras or TensorFlow installations on your system can lead to conflicts. Try uninstalling all existing versions and then reinstalling the latest versions.
-
Inspect
recurrentshop
Requirements: The traceback points torecurrentshop
as the source of the error. It seems this library might be outdated and incompatible with the newer Keras versions. You can try these options: -
Update
recurrentshop
: Check if a newer version ofrecurrentshop
is available that supports the updated Keras API. -
Find Alternatives: If
recurrentshop
is no longer maintained, consider exploring alternative libraries that provide similar functionality and are compatible with the latest versions of Keras and TensorFlow. -
Examine Code Compatibility: If you're still facing issues, review the code of the
Voice_ChatBot
repository. It's possible that the code relies on older Keras APIs that have been changed or removed. You might need to adjust the code to conform to the latest Keras structure.
Remember to restart your Python kernel or interpreter after making changes to your environment or code.
标签:python,tensorflow,keras,nlp From: 77232428