Trying to import DQNAgent like this
from rl.agents.dqn import DQNAgent
I get the following error:
cannot import name '__version__' from 'tensorflow.keras'
The installed versions are:
Tensorflow: 2.13.0, Keras: 2.13.1, Keras-rl2: 1.0.5
I am using Anaconda and Jupyter Notebook.
How can I fix this?
EDIT
If that helps to resolve the issue, this import
import tensorflow
from tensorflow import keras
print(keras.__version__)
causes
module 'tensorflow.keras' has no attribute '__version__'
Find one solution without modifying the source code. cite from:https://github.com/tensorflow/tensorflow/issues/50372
from keras import __version__
tf.keras.__version__ = __version__
and then:
from rl.agents import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory
In rl/callbacks.py change from tensorflow.keras to from keras import __version__. that should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With