Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommendation to synchronize tf, keras and keras rl versions? #397

Open
1 task
satyrmipt opened this issue Mar 27, 2024 · 3 comments
Open
1 task

Recommendation to synchronize tf, keras and keras rl versions? #397

satyrmipt opened this issue Mar 27, 2024 · 3 comments

Comments

@satyrmipt
Copy link

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'

@haison8x
Copy link

Yes, please keep updating this project.

@venuur
Copy link

venuur commented Apr 15, 2024

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

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

@Arefsa78
Copy link

Arefsa78 commented Apr 30, 2024

PR
use this PR. It worked for me.

Thanks to yuriiz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants