modular_rl icon indicating copy to clipboard operation
modular_rl copied to clipboard

'Dense' object has no attribute 'W'

Open jiadingfang opened this issue 8 years ago • 5 comments

Hi there,

I'm trying to reproduce the results. But when running the code, I first ran into the Monitor error which caused by the updates of the gym environments. And I fixed myself. But this time, another error occurred as follows

python run_pg.py --gamma=0.995 --lam=0.97 --agent=modular_rl.agentzoo.TrpoAgent --max_kl=0.01 --cg_damping=0.1 --activation=tanh --n_iter=250 --seed=0 --timesteps_per_batch=5000 --env=Pendulum-v0 --outfile=$outdir/Pendulum-v0.h5

Using TensorFlow backend. [2017-03-15 19:09:35,124] Making new env: Pendulum-v0 Traceback (most recent call last): File "run_pg.py", line 35, in <module> agent = agent_ctor(env.observation_space, env.action_space, cfg) File "/home/kudo/openai/modular_rl/modular_rl/agentzoo.py", line 118, in __init__ policy, self.baseline = make_mlps(ob_space, ac_space, cfg) File "/home/kudo/openai/modular_rl/modular_rl/agentzoo.py", line 36, in make_mlps Wlast = net.layers[-1].W AttributeError: 'Dense' object has no attribute 'W'

It seems that this error is due to the updates of Keras. Do you have an idea how to solve it? And it there a updated version of your library?

Thanks in advance.

jiadingfang avatar Mar 16 '17 08:03 jiadingfang

The new keras API seems to be layer.kernel instead of layer.W

nrhinehart avatar Mar 30 '17 17:03 nrhinehart

Hi,

Are there any plans to updated Modular-RL to the latest version of Keras and Theano? I made it locally but it would be nice to have these changes on the github. And as I've seen also there is a pull request fixing compatibility.

ViktorM avatar May 26 '17 13:05 ViktorM

I'm not using this code anymore, and have no interest in maintaining it. A better TRPO implementation will be released along with OpenAI Baselines.

joschu avatar May 26 '17 16:05 joschu

Thanks @joschu,

Looking forward for it will switch to the new implementation as soon as it is released. Do you have any estimations how soon it will be released? And also do you plan to add Q-Prop implementations to the OpenAI Baselines?

As I'm currently I'm using this one can you also help with one more question? I'm trying to apply TRPO to the robotics control task with vision. Do be able to use image from camera and joints values I should modify only make_mlps() in agentzoo.py, add convolution layers a top of the fully connected, and as input to the FC layers pass merged output from CNN layers and joints coordinate and velocities data? Or some more changes will be required?

ViktorM avatar May 26 '17 16:05 ViktorM

For anyone looking for a fix to these issues, I've got a fork here working with python 3 and the latest keras and gym versions: https://github.com/dominikandreas/modular_rl

dominikandreas avatar Jun 06 '17 10:06 dominikandreas