在我的 MAC M1 Air 上设置深度强化学习环境
Setting up deep reinforcement learning environment on my MAC M1 Air
I recently set up my MAC M1 Air to implement deep reinforcement learning.
But, when I started following this tutorial - Deep Reinforcement Learning Tutorial for Python https://www.youtube.com/watch?v=cO5g5qLrLSo&list=PLgNJO2hghbmjlE6cuKMws2ejC54BTAaWV&index=2, I got errors with DQN Agent as
In this part of the code.
Build Agent with Keras-RL
from rl.agents import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory
def build_agent(model, actions):
policy = BoltzmannQPolicy()
memory = SequentialMemory(limit=50000, window_length=1)
dqn = DQNAgent(model=model, memory=memory, policy=policy,
nb_actions=actions, nb_steps_warmup=10,
target_model_update=1e-2)
return dqn
dqn = build_agent(model, actions)
dqn.compile(Adam(lr=1e-3), metrics=['mae'])
dqn.fit(env, nb_steps=50000, visualize=False, verbose=1)
TypeError:Keras 符号 inputs/outputs 未实现 __len__
。您可能试图将 Keras 符号 inputs/outputs 传递给未注册调度的 TF API,从而阻止 Keras 自动将 API 调用转换为功能模型中的 lambda 层。如果您尝试直接断言符号 input/output,也会引发此错误。
I searched a lot for it and they are asking to downgrade TensorFlow for its compatibility with Keras-rl2. But, I don't see any such version available for the MAC silicon chip. Can someone please guide me, I have been stuck on it for far too long.
Any help is appreciated.
您遇到的问题是使用旧版本 keras-rl
的结果。该版本依赖于 model
class.
上已弃用的方法
您需要切换到 keras-rl2
。
I recently set up my MAC M1 Air to implement deep reinforcement learning.
But, when I started following this tutorial - Deep Reinforcement Learning Tutorial for Python https://www.youtube.com/watch?v=cO5g5qLrLSo&list=PLgNJO2hghbmjlE6cuKMws2ejC54BTAaWV&index=2, I got errors with DQN Agent as
In this part of the code.
Build Agent with Keras-RL
from rl.agents import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory
def build_agent(model, actions):
policy = BoltzmannQPolicy()
memory = SequentialMemory(limit=50000, window_length=1)
dqn = DQNAgent(model=model, memory=memory, policy=policy,
nb_actions=actions, nb_steps_warmup=10,
target_model_update=1e-2)
return dqn
dqn = build_agent(model, actions)
dqn.compile(Adam(lr=1e-3), metrics=['mae'])
dqn.fit(env, nb_steps=50000, visualize=False, verbose=1)
TypeError:Keras 符号 inputs/outputs 未实现 __len__
。您可能试图将 Keras 符号 inputs/outputs 传递给未注册调度的 TF API,从而阻止 Keras 自动将 API 调用转换为功能模型中的 lambda 层。如果您尝试直接断言符号 input/output,也会引发此错误。
I searched a lot for it and they are asking to downgrade TensorFlow for its compatibility with Keras-rl2. But, I don't see any such version available for the MAC silicon chip. Can someone please guide me, I have been stuck on it for far too long.
Any help is appreciated.
您遇到的问题是使用旧版本 keras-rl
的结果。该版本依赖于 model
class.
您需要切换到 keras-rl2
。