我正在做一个关于强化学习的项目,这是一个全新的项目。我将keras rl安装为然而,pip install keras-rl
导致了许多人提到的错误:
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.
解决方案是使用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 and keras-rl2==1.0.5 because these package versions have conflicting dependencies.
当我尝试特定版本时,即pip install keras-rl2==1.0.5
,输出为:
ERROR: Could not find a version that satisfies the requirement tensorflow (from keras-rl2) (from versions: none)
ERROR: No matching distribution found for tensorflow
我有tensorflow 2.6.0由苹果开发人员指南安装。知道如何安装keras-rl2吗?
1。在M1 Mac上安装Tensorflow
https://developer.apple.com/metal/tensorflow-plugin/
2.安装Keras-rl2
打开终端窗口并从以下位置运行这些命令:
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