2

我正在尝试实施 DQN 来解决 keras 的 RL 问题。我使用 MAC 并在 Anaconda Jupyter 环境中运行此代码。我已经尝试搜索或此错误,但我没有得到任何结果。代码

from rl.agents.dqn import DQNAgent
from rl.policy import EpsGreedyQPolicy
from rl.memory import SequentialMemory

错误

ImportError                               Traceback (most recent call last)
<ipython-input-31-7ffd4e2f21c3> in <module>
----> 1 from rl.agents.dqn import DQNAgent
  2 from rl.policy import EpsGreedyQPolicy
  3 from rl.memory import SequentialMemory

 /anaconda3/lib/python3.7/site-packages/rl/agents/__init__.py in <module>
  1 from __future__ import absolute_import
  ----> 2 from .dqn import DQNAgent, NAFAgent, ContinuousDQNAgent
  3 from .ddpg import DDPGAgent
  4 from .cem import CEMAgent
  5 from .sarsa import SarsaAgent, SARSAAgent

  /anaconda3/lib/python3.7/site-packages/rl/agents/dqn.py in <module>
  6 from keras.layers import Lambda, Input, Layer, Dense
  7 
   ----> 8 from rl.core import Agent
  9 from rl.policy import EpsGreedyQPolicy, GreedyQPolicy
 10 from rl.util import *

  /anaconda3/lib/python3.7/site-packages/rl/core.py in <module>
  6 from keras.callbacks import History
  7 
  ----> 8 from rl.callbacks import (
  9     CallbackList,
 10     TestLogger,

 /anaconda3/lib/python3.7/site-packages/rl/callbacks.py in <module>
  9 
 10 from keras import __version__ as KERAS_VERSION
 ---> 11 from keras.callbacks import Callback as KerasCallback, CallbackList as 
 KerasCallbackList
 12 from keras.utils.generic_utils import Progbar
 13 

 ImportError: cannot import name 'CallbackList' from 'keras.callbacks' 
 (/anaconda3/lib/python3.7/site-packages/keras/callbacks.py)
4

0 回答 0