GithubHelp home page GithubHelp logo

Comments (4)

ClaudiuFilip110 avatar ClaudiuFilip110 commented on June 2, 2024 3

Hi, I've had some problems with keras-rl and tensorflow and I managed to find a solution to this problem, after hours of trying to figure it out. Hopefully it works for you too.

keras-rl works with tensorflow 1.X, from my understanding, and keras-rl2 is supposed to fix that by requiring tensorflow>=2.1.0. Unfortunately, keras-rl2 is archived, so there can't be anymore fixes. My solution was this:

  1. Download the keras-rl2 source code from here
  2. Go into setup.py and remove the install_requirements=['tensorflow'], line OR you can even change it to tensorflow-macos
  3. Follow the install instructions from source code from here (the keras-rl2 instructions are incomplete)

Once you install keras-rl2 your problems should dissapear.

My issues here these:

  • ERROR: Could not find a version that satisfies the requirement tensorflow (from keras-rl2) (from versions: none) when trying to install keras-rl2
  • ERROR: when trying to do pip install keras-rl2==1.0.5
    Keras symbolic inputs/outputs do not implement __len__. You may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model. This error will also get raised if you try asserting a symbolic input/output directly.

Hopefully this helps.

from keras-rl.

IrodaRadjabova avatar IrodaRadjabova commented on June 2, 2024

hello everyone, can you help me to solve this issue
ImportError Traceback (most recent call last)
Cell In[11], line 5
3 from keras import version
4 tf.keras.version = version
----> 5 from rl.agents import DQNAgent
6 from rl.policy import BoltzmannQPolicy
7 from rl.memory import SequentialMemory

File /opt/anaconda3/envs/py311/lib/python3.11/site-packages/rl/agents/init.py:1
----> 1 from .dqn import DQNAgent, NAFAgent, ContinuousDQNAgent
2 from .ddpg import DDPGAgent
3 from .cem import CEMAgent

File /opt/anaconda3/envs/py311/lib/python3.11/site-packages/rl/agents/dqn.py:8
5 from tensorflow.keras.layers import Lambda, Input, Layer, Dense
7 from rl.core import Agent
----> 8 from rl.policy import EpsGreedyQPolicy, GreedyQPolicy
9 from rl.util import *
12 def mean_q(y_true, y_pred):

File /opt/anaconda3/envs/py311/lib/python3.11/site-packages/rl/policy.py:3
1 import numpy as np
----> 3 from rl.util import *
6 class Policy:
...
----> 3 from tensorflow.keras.models import model_from_config, Sequential, Model, model_from_config
4 import tensorflow.keras.optimizers as optimizers
5 import tensorflow.keras.backend as K

ImportError: cannot import name 'model_from_config' from 'tensorflow.keras.models' (/opt/anaconda3/envs/py311/lib/python3.11/site-packages/keras/_tf_keras/keras/models/init.py)
I've tried to solve this issue in python version 3.9, 3.8, 3.11, 3.10

from keras-rl.

ashokkushh avatar ashokkushh commented on June 2, 2024

hello everyone, can you help me to solve this issue ImportError Traceback (most recent call last) Cell In[11], line 5 3 from keras import version 4 tf.keras.version = version ----> 5 from rl.agents import DQNAgent 6 from rl.policy import BoltzmannQPolicy 7 from rl.memory import SequentialMemory

File /opt/anaconda3/envs/py311/lib/python3.11/site-packages/rl/agents/init.py:1 ----> 1 from .dqn import DQNAgent, NAFAgent, ContinuousDQNAgent 2 from .ddpg import DDPGAgent 3 from .cem import CEMAgent

File /opt/anaconda3/envs/py311/lib/python3.11/site-packages/rl/agents/dqn.py:8 5 from tensorflow.keras.layers import Lambda, Input, Layer, Dense 7 from rl.core import Agent ----> 8 from rl.policy import EpsGreedyQPolicy, GreedyQPolicy 9 from rl.util import * 12 def mean_q(y_true, y_pred):

File /opt/anaconda3/envs/py311/lib/python3.11/site-packages/rl/policy.py:3 1 import numpy as np ----> 3 from rl.util import * 6 class Policy: ... ----> 3 from tensorflow.keras.models import model_from_config, Sequential, Model, model_from_config 4 import tensorflow.keras.optimizers as optimizers 5 import tensorflow.keras.backend as K

ImportError: cannot import name 'model_from_config' from 'tensorflow.keras.models' (/opt/anaconda3/envs/py311/lib/python3.11/site-packages/keras/_tf_keras/keras/models/init.py) I've tried to solve this issue in python version 3.9, 3.8, 3.11, 3.10

do you got it?

from keras-rl.

IrodaRadjabova avatar IrodaRadjabova commented on June 2, 2024

from keras-rl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.