Giter VIP home page Giter VIP logo

Comments (8)

dementrock avatar dementrock commented on July 25, 2024

Have you tried this one? https://github.com/openai/rllab/blob/master/rllab/algos/nop.py

from rllab.

lchenat avatar lchenat commented on July 25, 2024

I tried NOP got the following error:

Traceback (most recent call last):
File "/home/data/lchenat/rllab-master/scripts/run_experiment_lite.py", line 115, in
run_experiment(sys.argv)
File "/home/data/lchenat/rllab-master/scripts/run_experiment_lite.py", line 102, in run_experiment
maybe_iter = concretize(data)
File "/home/data/lchenat/rllab-master/rllab/misc/instrument.py", line 1018, in concretize
return method(_args, *_kwargs)
File "/home/data/lchenat/rllab-master/rllab/algos/batch_polopt.py", line 250, in train
paths = self.sampler.obtain_samples(itr)
File "/home/data/lchenat/rllab-master/rllab/algos/batch_polopt.py", line 27, in obtain_samples
cur_params = self.algo.policy.get_param_values()
File "/home/data/lchenat/rllab-master/rllab/core/parameterized.py", line 57, in get_param_values
for param in self.get_params(**tags)]
File "/home/data/lchenat/rllab-master/rllab/core/parameterized.py", line 34, in get_params
if tag_tuple not in self._cached_params:
AttributeError: 'UniformControlPolicy' object has no attribute '_cached_params'

I am a bit confused about this, because in parameterized.py _cached_params is actually set:

class Parameterized(object):

def __init__(self):
    self._cached_params = {}
    self._cached_param_dtypes = {}
    self._cached_param_shapes = {}

from rllab.

dementrock avatar dementrock commented on July 25, 2024

Hmm weird. I cannot reproduce the error on my end. What if in the initializer of UniformControlPolicy, you explicitly invoke Parameterized.init(self)?

from rllab.

lchenat avatar lchenat commented on July 25, 2024

i invoke Parameterized.init(self) in Policy, it seems that I have an old version of RLLAB. I then got this error:

Traceback (most recent call last):
File "/home/data/lchenat/rllab-master/scripts/run_experiment_lite.py", line 115, in
run_experiment(sys.argv)
File "/home/data/lchenat/rllab-master/scripts/run_experiment_lite.py", line 102, in run_experiment
maybe_iter = concretize(data)
File "/home/data/lchenat/rllab-master/rllab/misc/instrument.py", line 1018, in concretize
return method(_args, *_kwargs)
File "/home/data/lchenat/rllab-master/rllab/algos/batch_polopt.py", line 251, in train
samples_data = self.sampler.process_samples(itr, paths)
File "/home/data/lchenat/rllab-master/rllab/algos/batch_polopt.py", line 73, in process_samples
ent = np.mean(self.algo.policy.distribution.entropy(agent_infos))
AttributeError: 'UniformControlPolicy' object has no attribute 'distribution'

from rllab.

lchenat avatar lchenat commented on July 25, 2024

I am using python 2.7, and I got the same problem after downloading the rllab-py2 again.

from rllab.

lchenat avatar lchenat commented on July 25, 2024

By the way, when I am running multiple python scripts for different algorithms, I got the following errors:

using seed 8
using seed 8
Could not import matplotlib.pyplot, therefore cma.plot()" + etc. is not available
Error while instantiating <class 'rllab.policies.gaussian_mlp_policy.GaussianMLPPolicy'>
Traceback (most recent call last):
File "/home/data/lchenat/rllab-master/rllab/misc/instrument.py", line 1032, in concretize
_args, *_kwargs)
File "/home/data/lchenat/rllab-master/rllab/policies/gaussian_mlp_policy.py", line 110, in init
super(GaussianMLPPolicy, self).init(env_spec)
File "/home/data/lchenat/rllab-master/rllab/policies/base.py", line 7, in init
super(Policy, self).init()
TypeError: init() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
File "/home/data/lchenat/rllab-master/scripts/run_experiment_lite.py", line 115, in
run_experiment(sys.argv)
File "/home/data/lchenat/rllab-master/scripts/run_experiment_lite.py", line 102, in run_experiment
maybe_iter = concretize(data)
File "/home/data/lchenat/rllab-master/rllab/misc/instrument.py", line 1014, in concretize
obj = concretize(maybe_stub.obj)
File "/home/data/lchenat/rllab-master/rllab/misc/instrument.py", line 1029, in concretize
kwargs = concretize(maybe_stub.kwargs)
File "/home/data/lchenat/rllab-master/rllab/misc/instrument.py", line 1044, in concretize
ret[concretize(k)] = concretize(v)
File "/home/data/lchenat/rllab-master/rllab/misc/instrument.py", line 1038, in concretize
ret = maybe_stub.stub_cache
File "/home/data/lchenat/rllab-master/rllab/misc/instrument.py", line 155, in __getattr

raise AttributeError('Cannot get attribute %s from %s' % (item, self.proxy_class))
AttributeError: Cannot get attribute __stub_cache from <class 'rllab.policies.gaussian_mlp_policy.GaussianMLPPolicy'>

Is it ok to run several algorithms in different scripts at the same time?

edit: oh, it is not the problem of running several scripts, it is actually caused by adding "super(Policy, self).init()" in init of policy base class. I added this because it seemed to solve the uniform control policy problem.

from rllab.

dementrock avatar dementrock commented on July 25, 2024

I just pushed a fix: 55b7df1 to the attribute error issue.

I recommend upgrading to the master branch which uses python 3. Also, it is recommended to explicitly call the superclass constructor instead of using super.

from rllab.

lchenat avatar lchenat commented on July 25, 2024

done! Thanks for your update.

from rllab.

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.