【问题标题】:Setting up deep reinforcement learning environment on my MAC M1 Air在我的 MAC M1 Air 上设置深度强化学习环境
【发布时间】:2021-05-28 11:36:39
【问题描述】:
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 符号输入/输出未实现 __len__。您可能正在尝试将 Keras 符号输入/输出传递给未注册调度的 TF API,从而阻止 Keras 自动将 API 调用转换为函数模型中的 lambda 层。如果您尝试直接断言符号输入/输出,也会引发此错误。

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.

【问题讨论】:

  • 请直接将代码作为文本包含在问题中,而不是作为外部链接(甚至不作为 youtube 视频!)
  • 我已经编辑过了,希望对你有帮助。很抱歉我是新手。

标签: tensorflow keras deep-learning reinforcement-learning apple-m1


【解决方案1】:

您遇到的问题是使用旧版本的keras-rl 造成的。该版本依赖于 model 类上已弃用的方法。

你需要切换到keras-rl2

【讨论】:

    猜你喜欢
    • 2018-11-05
    • 2020-06-30
    • 2018-10-18
    • 2021-08-18
    • 2022-01-17
    • 2016-10-24
    • 1970-01-01
    • 2017-01-28
    • 2019-10-20
    相关资源
    最近更新 更多