ngx-toastr icon indicating copy to clipboard operation
ngx-toastr copied to clipboard

Recommendation to synchronize tf, keras and keras rl versions?

Open satyrmipt opened this issue 10 months ago • 3 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'

satyrmipt avatar Mar 27 '24 20:03 satyrmipt

Yes, please keep updating this project.

haison8x avatar Mar 29 '24 08:03 haison8x

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

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

venuur avatar Apr 15 '24 23:04 venuur

PR use this PR. It worked for me.

Thanks to yuriiz

Arefsa78 avatar Apr 30 '24 02:04 Arefsa78