在我的 M1 Macbook Pro 上设置 keras-rl2

发布于 2025-01-19 03:54:39 字数 1033 浏览 0 评论 0 原文

我正在研究一个关于强化学习的项目——而且是全新的。我安装了 keras-rl 作为 pip install keras-rl,但是它导致了许多人提到的错误:

类型错误:Keras 符号输入/输出未实现“__len__”。您可能尝试将 Keras 符号输入/输出传递到未注册调度的 TF API,从而阻止 Keras 自动将 API 调用转换为功能模型中的 lambda 层。如果您尝试直接断言符号输入/输出,也会引发此错误。

并且解决方案是使用 keras-rl2。但是,我无法在 Mac M1 上安装 keras-rl2,因为输出如下:

ERROR: Cannot install keras-rl2==1.0.0, keras-rl2==1.0.1, keras-rl2==1.0.2 、keras-rl2==1.0.3、keras-rl2==1.0.4 和 keras-rl2==1.0.5 因为这些包版本有冲突依赖关系。

当我尝试特定版本时,即 pip install keras-rl2==1.0.5,输出为:

ERROR: Could not find a version that satisfies the required tensorflow (from keras-rl2) (from versions: none)< /code>

错误:找不到张量流的匹配分布 我通过 Apple 开发人员指南安装了tensorflow 2.6.0。知道如何安装 keras-rl2 吗?

I am working on a project on Reinforcement Learning - and completely new at this. I installed keras-rl as
pip install keras-rl, however it caused an error as many has mentioned:

TypeError: Keras symbolic inputs/outputs do not implement `__len__`. You may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model. This error will also get raised if you try asserting a symbolic input/output directly.

And the solution for this is to used keras-rl2. Howver I cannot install keras-rl2 on my Mac M1 as the output is following:

ERROR: Cannot install keras-rl2==1.0.0, keras-rl2==1.0.1, keras-rl2==1.0.2, keras-rl2==1.0.3, keras-rl2==1.0.4 and keras-rl2==1.0.5 because these package versions have conflicting dependencies.

When I tried a specific version, i.e
pip install keras-rl2==1.0.5, the output is:

ERROR: Could not find a version that satisfies the requirement tensorflow (from keras-rl2) (from versions: none)

ERROR: No matching distribution found for tensorflow
I have tensorflow 2.6.0 installed by Apple Developer guide. Any idea how I can install keras-rl2?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拧巴小姐 2025-01-26 03:54:39

1。在M1 Macs上安装TensorFlow

2。要安装keras-rl2

打开一个终端窗口,然后从:

https:/https:/ /Github.com/keras-rl/keras-rl (最后一行更改)

git clone https://github.com/wau/keras-rl2.git
cd keras-rl
python3 setup.py install

setup.py脚本仍然会告诉您它找不到TensorFlow版本,但您仍然可以使用以下方式导入它:

import rl

1. To install Tensorflow on M1 Macs

https://developer.apple.com/metal/tensorflow-plugin/

2. To Install Keras-rl2

Open a terminal window and run these commands from:

https://github.com/keras-rl/keras-rl (last line changed)

git clone https://github.com/wau/keras-rl2.git
cd keras-rl
python3 setup.py install

The setup.py script will still tell you that it can't find a TensorFlow version but you will still be able to import it using:

import rl
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文