keras-rl / keras-rl

Deep Reinforcement Learning for Keras.

Home Page:http://keras-rl.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recommendation to synchronize tf, keras and keras rl versions?

satyrmipt opened this issue · comments

Please recommend how users should synchronize versions of tf, keras and keras rl?

  • [OK ] Check that you are up-to-date with the master branch of Keras-RL. You can update with:
    pip install git+git://github.com/keras-rl/keras-rl.git --upgrade --no-deps

I install it through pip install:

  > pip install keras-rl
  >  Downloading keras-rl-0.4.2.tar.gz (40 kB)
  >  .....
  • [ OK] Check that you are up-to-date with the master branch of Keras. You can update with:
    pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps

I install it through pip install the same hour as keras-rl:
>> pip install keras
keras.version='3.1.1'

  • Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short). If you report an error, please include the error message and the backtrace.

My code

from rl.policy import LinearAlleniaedPolicy, EpsGreedyQPolicy
policy = LinearAlleniaedPolicy(EpsGreedyQPolicy(), 
                               attr='eps',
                               value_max = 1.0,
                               value_min = 0.1, 
                               value_test = 0.05,
                               steps_cnt = 500_000
                              )

return

Traceback (most recent call last):

  Cell In[43], line 1
    from rl.policy import LinearAlleniaedPolicy, EpsGreedyQPolicy

  File ~\anaconda3\envs\reinf_learning_hw2\lib\site-packages\rl\policy.py:4
    from rl.util import *

  File ~\anaconda3\envs\reinf_learning_hw2\lib\site-packages\rl\util.py:3
    from keras.models import model_from_config, Sequential, Model, model_from_config

ImportError: cannot import name 'model_from_config' from 'keras.models'
(~anaconda3\envs\reinf_learning_hw2\lib\site-packages\keras\models\__init__.py)

Usually i can workaround it myself by replacing keras.models to **tf**.keras.models in the source but this time I have no idea where to find model_from_config function.

Python: 3.10.14
tensorflow.version='2.16.1'

Yes, please keep updating this project.

I'm having a similar issue. The code from rl.agents.dqn import DQNAgent triggers

ModuleNotFoundError: No module named 'keras.utils.generic_utils'

PR
use this PR. It worked for me.

Thanks to yuriiz